Yesterday Enova hosted a hackathon on the Purdue campus, but not in the traditional sense. Instead of everyone making a unique project that would then be subjectively judged, the people at Enova built an online poker game. The task at hand was to build a bot that would contact the server to determine the game state, then if it was the bot’s turn to play, make a move. It was a pretty standard poker game. You started with $1000 with a small blind of $10 and a big blind of $20. Throughout the game as players were eliminated the blinds increased and the game started to move faster.
For the first few practice rounds, our bot (TJ Root and myself) stayed ahead of the crowd. We were one of the first teams to have a stable handling of POST and GET requests as well as the basic JSON parsing. We placed in the top five in the first round, and again in the second, although I do not remember the exact placement. For the final practice round we hit a sweet spot with our bot, and it flew ahead with a very clear and decisive victory. After that, we decided not to change our code, and wished to play it safe for the actual tournament. Unfortunately there were some people that gave up working on thinking bots and randomly bet. Our bot’s tendency to play a hand when it had already committed to a blind was no longer safe, as the other players at the table were no longer logical. We got hit hard quickly and had to pull that logic. With a bot that played it safer, we slowly crept up again. From a near defeat we pulled back up into fourth place. First and Fourth had bots that followed poker logic and worked to play a smart game, while second and third got lucky with random number generators. Unfortunately fourth didn’t walk home with a prize, but it was still a blast.
The code is below. We adjusted the number of pairs needed to keep betting and the way the bot handled blinds depending on the way other players were responding.