Hi, people! Going to just make this as brief as I can today, don`t feel up to much. The Player class has 177 lines when I got rid of all the (rightfully present) comments, so you can keep track of how far we have to go before the end.
Let`s get right into some methods now, with a few get...() methods and reset...() methods (among others) as you might expect would be needed in a round-based game:
Here we have our getClient method, separate from the others for whatever reason. Didn`t really sink in until I uploaded the screenshot, though, so it can stay.
Line 39 marks the beginning of the resetHand() method that we saw used in the constructor. This should remove all cards from the player`s hand (Think about it less in terms of programming, and more what would actually happen in a game. The player doesn`t get to hold onto his hand!). At this point, the boolean flag should be changed to reflect this, and with a new hand comes a new bet.
Line 45 starts the method that goes about resetting the bet. Fairly self-explanatory, all bet-related amounts are reset to 0, and the last-action variable is also reset.
Easy so far, right? Well, sorry to burst your bubble, but (heh, bubble butt.)...
Oh my god, a method that takes more than 5 lines! This is used to set the hole cards (The one's unique to this player). To give the player cards, we should first remove all cards they currently hold. I would assume that the resetHand method takes care of this, but it's best to be careful!
The next little chunk makes sure there are actual cards to put into the hand.
Line 57-60 are what happens if the number of cards is legal (2 personal cards, since 3 are public), and just adds the cards. I'm still confused about the string being thrown out starting with "[CHEAT]...", since, as far as I can tell, there's no cheating at all. Weird, but, I'll keep it in for now, and remove it when we're closer to completion assuming there's not some other use for it I haven't thought of.
Lines 61-62 just cover the case of personal cards not being 2, a simple exception is thrown!
Finally for tonight, we have a few more get methods and then the boolean method to specify if the player actually has cards. Think of it as getHasCards, but named in a less ridiculous manner.
See you guys tomorrow! 100 lines to go! Q's and comments welcome!
100 lines doesn't seem like too much compared to these. Badass, I wanna see the outcome.
ReplyDeleteGogogogo! We've come a long way and we're finally almost done!
ReplyDeleteGoing fine.:)
ReplyDeleteThe cheats a cheat!
ReplyDelete