Friday, 16 December 2011

Java: Texas Hold Em (23)

Hey hey, time for another post. Last time we left off at getCash for the Player class, after a number of get methods and some other crap. Luckily, there's a buttload more of get methods to go through, so we still have some easy stuff around. Just a heads up though, on Monday we'll go through a larger method that uses the switch-statement.

This week is my final make-up week where I make weekend posts, so tomorrow, as promised, I'll cover string formatting in more detail, and on Sunday I'll actually refresh us all on the switch statement, just in case you need it!

Here we go, a bunch more get methods, just returning values that are otherwise private, making them accessible to stuff outside this specific class, without allowing them to be changed. But you probably knew that's why we use get instead of just calling the variable :P

isBroke is similarly simple, just returning whether or not the player in question is out of cash!

Oh no, actual methods! We've just got some ways to post the blinds here, setting the action to whatever type of blind it is, then removing the cash from the player and adding the amount to the bet.
Really easy stuff for now, eh?
Finally, we have a couple of methods here relating to the All In Pot, 1 to get how much there is, and 1 to set how much there is.

Get ready to ramp up the difficulty curve on Monday, folks! But not by too much! Questions and comments welcome, see you tomorrow for string formatting!


  1. Yay there's gonna be a refresh :D

  2. I'm starting to get this and your ramping up the difficulty? I'm ready!

  3. My body is ready.

  4. So if the player is out of cash does it automatically kick them out of the game?