Monday, 9 January 2012

Java: Texas Hold Em (36) - Debugging the client

Okay, folks, going to keep it short. Today, I'll show you some screens of how the client works inside the IDE and point out some stuff that might need fixing. This'll not only give you the opportunity to thing about how it's going on, but what I might have missed so you can suggest a fix of your own!

Here we go:
Okay, to start this, we just run the console client. In Netbeans, you do this by hitting Shift+F6 with open. Just F6 will try to run the main class of the active project, but that's not what we want.

The below should pop up for us:

Hey, there's no GUI yet, right? So of course its ugly, but we can still make sure it works. Straight away, we see New Hand come up twice. I've no idea why this is. Could be something to look into.
note: I named the bots Buttface, Facebutt and Pirate Joe. I am not a mature person, and just so you're not confused as to what those are!
First person to the left of dealer posts the small blind (Not necessarily displayed here. It'll be on the board in the GUI.) then Facebutt does his thing.

Ah, that's why there was a "CHEAT" in the strings. It shows you the opponents cards. Either this will stay to the client and not be displayed, or they're there purely for debug purposes! Woohoo! The player's cards are shown, so that's fair enough etc etc. Pirate Joe's turn, he calls, because he's a dummy bot and they don't do much...
Oh here we go, Player's turn! Now, as part of the debugging process, you want to test both that what's supposed to happen happens, and that it's not so easily broken!

Oh dear. I thought anything starting with an "F" would make me fold. Maybe it's the spaces etc. No? But just F works. This isn't so much a debug issue as me misreading the code from earlier. The highlighted bit at the bottom of the screenshot actually reads:
"If the command starts with whatever the input is as a WHOLE (but lowercase)..."
which means the commands accepted would be "f", "fo", "fol" or "fold". Learning experience! And then I folded. So the game continued without me until a new hand came around! Well, it looks like that much is working, at least!

And that's it. Sorry it was short, but I've been super busy of late! See you tomorrow, questions and comments welcome! See ya tomorrow!


  1. Buttface and Facebutt are some pretty fierce competitors.

  2. It's a decent sized post. And it's funny too. I like Facebutt and Buttface.