Thank you for visiting Blazing Games

Poker Dice Beta

13:30 The only thing left to do to have the game reach a code complete state, and it is early in the afternoon so this game is coming together really fast, is to get the computer opponent working. My first thought about developing an AI would be to simply go through every combination and roll every possible outcome. Rolling 5 dice results in 7776 possible hands. This means that I would roughly have to check 100,000 hands (there are 32 different combinations of hands, with the dice having to be looped through for each of those). The combination that resulted in the best average result would be the best one to use. While ActionScript 3 is certainly fast, that is still an awful lot of computation. So I am going to think about this over a cup of hot chocolate.

14:00 A much better solution came to mind while I was drinking my hot chocolate. Instead of looping through combinations, why don't I just play the game the way I personally would if I was playing the hand and nobody else had played a hand. The best part is that all the information I need to do this has already been calculated for me in the form of the score that was calculated. Simply use the hand type to determine which dice should be kept. All the relevant dice information is already worked out as the score so I simply need to break apart the score and then select the dice. Of course, before doing any of this, I had to first separate the calculation of the hand score from the actual final scoring of the hand.

This leads to the subject of debugging. While there are a lot of programmers who do all of their debugging in the debugger, I am more old-school when it comes to debugging. While I have no problems using debuggers (and really wish that the Flash/Flex debugger was better) I tend to see them as a last resort. Instead I try to think my way through the problem. When it comes to AI, this is not always that easy, so it is really nice to be able to take a look at how the AI is thinking. While this can be done by watching variables in the debugger, it is much faster (at least for me) to write a simple debug string that summarizes the AI's thought processes and send that information to the log or console window. This way, you can play the game for a while and then just look over the log to see any strange behavior like not keeping any dice when the computer has a pair or better. When you see this type of behavior, you can look at the code for handling pairs and quickly realize that you are using the wrong array index. But at least once the simple bug has been fixed, you can finally publish the beta build.

Previous page
Making Poker Dice Page 5

About - Privacy Policy - Contact - Links - FAQ
Copyright © 2008 Blazing Games Inc. All Rights Reserved