Tuesday, 13 December 2011

Java: Texas Hold Em (20)

Hey now, the Client isn't empty, only everything that it does is! Wait, does that make it sadder? Who cares, it probably deserves it. That's right folks, it's time to get the Client done, and therefore officially the start of the "What the fuck am I doing, and why?" part of the project! At least we're not at the "What am I doing, and how am I supposed to work out how?" part?

Here we go!


The client should basically show the information of the Table and act on behalf of, or represent, a player, be it a human or AI (That'll be fucking fun.) Since the client  represents a player, and the player requires a client, each relies on the other, so expect a lot of red underlines where you use the Player class before it exists!

So uh, what should we have in terms of methods for the Client interface? Since it displays Table information, we'll probably want some way to handle any messages given to the client.
We'll also want a way to handle any players at the table, a way to update the board, and finally, something to determine which actions are actually allowed at a given time (So all players can't just bet constantly or something)

Luckily, as said before, this is just an interface, so we don't need to fill out info, just create the methods!


Okay, let's go through this to the best of my ability.
First, a simple method to handle received messages. When actually in use, this will probably update a text box on the GUI, so it doesn't need to return a string for later use, so void is an okay return type!
Next, we have something to take care of any players joining a table, and will probably just add that player to a list of current players.
Another player handler is next, and this should take care of turn order!
More player handling. Players are needy, man. This'll update their screen, so they know what's going on! (Probably)
This next one actually updates the entire board with global information like the cards on the table or whatnot. Makes more sense to have a global and private instead of redoing the global for each player!
Our final player handler, and I don't even know what this will do. Maybe look at the player given and find the action they took and...animate it? I don't know, we'll see!
Finally, our first non-void! This actually returns whatever action the player took (Remember that enum?), and is given only a list of currently allowed actions!


Hm, that was only 1 screenshot, but it was an entire interface file, so I'm torn! Do I continue, or not? Well, tortoises are lazy (probably), so I'll go with not. Tomorrow, we get back to real classes, with souls and stuff. Either the Player proper, or the ConsoleClient. WE SHALL SEE, And I shall see you tomorrow! Have fun, questions and comments welcome!

5 comments:

  1. making a GUI in java is not as difficult as other languages if i recall correctly. you get a deep understanding of the game by programming it!

    ReplyDelete
  2. The souless client makes me sad! If what it does is empty then it is empty in a way...

    ReplyDelete