Tuesday, 10 January 2012

Java: Texas Hold Em - Debugging (2)

Woo, change to the titling, because I kept losing track of what number we were on, and I can't count past 40 anyway. Okay, so we looked at the folding, and that seems to work. We should still see if we can stop the New Hand message appearing twice, so let's do that, then tomorrow we can move on to testing another action.



Let's go through this logically. There's 2 messages that say the same thing, but the main method for this only calls the ConsoleClient class. Since nothing else is done, the issue must be within the constructor, since no methods are applies to the client object.

The constructor....


...has only 1 method that could be printing out this message, which is the start() method. Going to the Table class we'll want to look for something that happens at the start of the hands, and we have our resetHand method. As we can see on the highlighted lines below...




...there's a message sent out twice. Once through the client's method, and once through notifyMessage. So we have a choice (probably). notifyMessage uses the client's messageReceived method. Back to the ConsoleClient, we see that messageReceived used a simple System.out.println, and handStarted uses the simple string formatting. Both so the same damn thing, so let's comment out the line of code within the handStarted method to get the following result...


Ta-da! Looks like that worked out fine. Tomorrow I guess we'll play a quick round and see if the pot/bets are working fine! See you then! Questions and comments welcome! Also, sorry this was late, I kinda forgot about it until just now, ha.

3 comments:

  1. You know, debugging isn't THAT bad..

    ReplyDelete
  2. Hey finally managed to access your blog. I think Blogger has been acting up lately.

    And it looks like more debugging is what I missed.

    ReplyDelete
  3. Oh? I hope the problem isn't my fault :x And it's okay, debugging is easy for something like this. For now.

    Imagine a game like League of Legends where a bug might just be the way a specific character interacts with some mechanic that works otherwise perfectly, and trying to fix THAT.

    ReplyDelete