One of the most time consuming tasks in the developement of our poker app is quality control…
– commenting every segment (to prevent misunderstandings on updates)
– long code review sessions
– equip each function with detailed data monitoring code (e.g. each interface)
– writing thousands of test cases
– test runs, test runs and more test runs
This is especially important for poker programs, as every bug in the AI will result in exploitable behaviour or other problems that spoil the fun of the game.
Numerous bugs in every single of the available offline-poker-apps (!) was the reason that started this project, so special care is taken not to make the same mistakes.
To start a poker program, a function is required that converts any number of cards (in texas hold-em 5 to 7 cards) into a hand value with a defined order.
This usually is represented by an integer where a higher value means a better hand (in showdown a simple compare is done, the highest value wins).
The attached hand ranking function might not be the fastest way to do so (the poker app does not have to check millions of hands per second as online poker bots do), but it does its job and is easy to understand for debugging and teaching purposes.
In case you think your code is better, feel free to email us or post it in the comments, open for discussion.
In case you wonder why some hands are more valuable than others:
The higher the probability to get a hand, the lower its value.
The probability to get a Royal Flush, a Straight Flush or a Four-of-a-Kind is less than one percent each (even after the river), thus they are the most valuable hands.
The probability to get a pair is already close to 50% on the flop, thus not very valuable.
The following document shows the probability to get each hand in flop, turn and river. For those curious enough, I added the mathematical formulas how to calculate these values.
P.D: This document is still in German as I don’t see much value in translating the description of each mathematical formula. It is important to be published along with the data for traceability, but other than that it is irrelevant for any upcoming analysis.
All theory must start with a set of rules as a base for the upcoming analysis.
The here shown rules are written in German, as they are derived from the house rules I wrote for our poker group several years ago.
As the rules of Texas Hold-em are widely available (e.g. at Wikipedia), I believe no translation is necessary.
Here is a short overview of the actual game interface.
There are no opulent graphics yet, but it works fine to test the engine and artificial intelligence.
The screenshots shows a table with 9 players after showdown: 6 folded, 3 showed their cards… player 3 (P3) won, P2 got some money back (as P3 was all-in) and the human player lost.
On this easter weekend we were finally able to release a first alpha version of the Poker Trainer App.
There is still much work to do, but at least we reached a point where third party tests are possible of what we archived in the last 22 month.
2014 Jun 10 – Start of theoretical analysis for this project
2014 Jul 14 – Start of function coding for analysis (VBA)
2014 Nov 11 – Start of function coding for poker trainer app (C++)
2015 Mar 08 – Start of intensive internal code review
2016 Mar 11 – End of code review, start test phase of game engine
2016 Mar 26 – Compile build of first alpha version
Sorry it took so long but the 1-year code review was necessary… every single function had to be sent through a test center where thousands of test-cases needed to be programmed… and every interface (between programs, classes and functions) had to be equiped with detailed data monitoring code and bug reporting systems…
Having to do this in your free time can take very very long and be very very boring.