Earlier this year I created a Monte Carlo Texas Holdem Simulator using an IronPython powered spreadsheet in Resolver One. The main goals were to learn IronPython, test how well it worked for creating complex spreadsheets, and enter a few of those spreadsheets into the Resolver One competition. Well I can honestly say that I exceeded even my own expectations on all three accounts, and it didn’t stop there either. After learning IronPython I started using it for the occasional random “Hey could you ...” tasks that get assigned to me at work, and I found a few other interesting uses for Resolver One as well.
I also found that I really like coding contests! After the Resolver One competition ended, I came across another .NET coding contest sponsored by the International .NET Association (INETA) that was trying to promote reusable components from various vendors. I submitted Windows Form and Windows Mobile versions of the Texas Holdem hand evaluator, along with a short video clearly showing why my younger brother is a professional radio DJ and I am not :-P I didn’t have enough time to get everything that I wanted to into the new versions, but it was still enough to get an honorable mention and score a few free licenses for .NET components from the sponsors.
Shortly after the INETA contest, I found a Silverlight contest sponsored by Telerik. Since I learned IronPython in the Resolver One contest I figured that this was a great excuse to spend a week or two learning Silverlight, WPF, and XAML. While I didn’t end up winning the contest, I did get a license for their Silverlight controls and was able to create a pretty cool Silverlight 3.0 Texas Holdem Monte Carlo simulator that runs entirely in the browser. I also organized all the source code and various versions of the application into one website for all your Poker needs.
I have had a few people ask about how to modify the poker spreadsheet for different purposes, such as analyzing the outcome for specific hand groups or being able to include multiple hands in the player’s pocket card set. The original spreadsheet was designed to show the hands in a specific layout so it is not very easy to customize. Instead I made a new spreadsheet that uses a standard column layout and lets you enter hands using the Hand Query language that is integrated into the C# HandEvaluator library. This new spreadsheet lets you customize the opponent hands and allows you to define multiple hands for the player (ie: What would my odds be if I had AK offsuit or AQ offsuit?). It also lets you specify the number of trials to run for each Monte Carlo simulation and is smart enough to enumerate the cards if you specify more trials than it would take to go through all possible board cards.
If you want to try out the new poker spreadsheet you can download it from the Resolver Exchange. The free player license for Resolver One will let you open and run the spreadsheet, but you will need a commercial license or research license if you want to make any changes to the code. I would like to add multi-threading and a hand win type breakdown table, but there is another coding contest deadline coming up, so I have to work on another project for a little while :-P