This started as an experiment. I wanted to see how challenging it would be to build a system that could follow a game of poker on-screen, and understand every step of the game.
I’ve designed almost every component of this experiment to be as dynamic as possible, with the long-term goal being a complete poker system that can be easily re-adapted for different Texas HoldEm interfaces with minimal work and preferably without recompiling the whole project.
Zynga Texas HoldEm Poker
To start with I’ve decided to use the popular facebook-based Texas HoldEm Poker run by Zynga. It’s free to play, all game money is free money (unless you make the choice to buy more chips from Zynga), and it should provide a reliable starting system to test the effectiveness of this system in a real environment.
Since this system is designed to run on my personal macbook pro, the API is built with various components written in either C, C++, or Objective-C; depending on whether 3rd-party API was used.
Various features of the interface can be used to determine the state of the game. The player state has been split into the following states:
Each of these states is key for the API to understand what is needed of it. Reliably determining each of these also has a number of challenges associated. It’s certainly not impossible, but it’s not always reliable. With time the methods that drive this workflow will improve, right now the goal is finishing the proof of concept to the point where it’s a semi-automated bingo-bot. Once that’s done, work will continue into a more advanced decision making process all the way to the river stage of the game.
What is a bingo bot, in the context of HoldEm poker? Check out this thread:
This is a relatively “simple” poker bot that takes the pocket-cards that have a higher probability of winning, and plays the lazy tactic of going all-in in the pre-flop stage of the game. It’s not always reliable, but can bring significant results in the long-term due to the probabilities involved. Not only does it have the potential of significant results by playing with the highest odds, but it’s also the easiest to program, since we only need to check for pocket cards and the probabilities involved before going all-in or folding.
The simplest form uses the current pocket cards in the decision making process, and goes all-in when specific cards are found. From past experimenting with the AutoIt bot for windows, these are the pocket cards I wanted to experiment with (since they’ve brought results for me in the past): AA KK QQ JJ AJ AK TT 99 88 77 AQ KQ.
In the current state of my poker bot for mac, this is relatively easy to check for:
NSString *pocketCards = self.pokerTable.myPlayer.getPocketCards;
NSLog(@”got pocket cards: %@”,pocketCards);
NSString *allInCardsStr = @”AA KK QQ JJ AJ AK TT 99 88 77 AQ KQ”;
NSSet *allInCardsSet = [NSSet setWithArray:[allInCardsStr componentsSeparatedByString:@” “]];
NSLog(@”checking if cards (%@) are found in set: %@”,pocketCards, allInCardsStr);
bool shouldAllIn = [allInCardsSet containsObject:pocketCards];
If a match is found, the bot will go all in.
In one instance the results were extremely encouraging, but the dataset is too small to be significant:
The “rounds played” metric isn’t accurate yet, but relatively close to the real number of hands played. Assuming the number is accurate, the bot played 12 hands in $2/4k blinds and made a profit of $4.6 million. Technically that may either be one or two really lucky wins, or several combined. Either way, results are results, and signs of progress are motivation to keep digging further into this challenge.
This form of bingo-botting isn’t reliable enough though for my liking. Why? It uses predefined pocket cards rather than real odds. The probabilities of winning vary depending on not just the cards in your hand, but also the number of players involved. This kind of preflop recognition doesn’t account for that. The next post will cover how I addressed that.