I've been working on this project for over a year and a half, and now I'm abandoning it. So that this time isn't wasted, I'm open-sourcing the code. Java+Spring. Take the project "as is," with all its ad-hoc workarounds, unfinished research, TODOs, as well as all sorts of KISS, DRY, and, what are they called... SOLID and GoF.
It is assumed that you are familiar with poker, have solid programming skills, and have a basic understanding of game theory.
This is a poker bot builder. It's something like a no-code platform. You assemble a strategy like a puzzle from pieces. There are about 3500 puzzle pieces in total. The puzzles are "dual" – you can configure frequencies for both action types and bet sizes.
There is manual strategy configuration. As an alternative to manual configuration, there is the ability to use ML-puzzles. These are trained models for a customizable poker situation. The third type of puzzle is playing according to a counter-strategy. I wasn't able to fully refine the counter-strategy, so this option isn't currently supported. Building a counter-strategy is extremely complex from a coding perspective and very computationally expensive. Lately, I've been working on the GameTreeGenerator class, which builds a poker game tree based on collected statistics on the opponent. It requires significant refinement.
Technically, it's a Java+Spring application, with one GraphQL controller. Through the controller, datasets and bots are created, bot strategies are configured, and hints are requested.
The HoldemHandStrengthCalculator class can calculate win rates for given player hand ranges.
The engine package contains abstractions for a poker hand and a player. Pay special attention to the PokerEngine class – this is the finite-state machine logic for determining the situation in a poker hand.
The holding package contains hand descriptors for the hero. Descriptors are calculated in HoldingEvaluator. Descriptors are key decision-making factors in a hand and form a substantial part of the overall feature set.
The spark package, specifically PipelineUtils, can build ML models – decision trees.
Instances of the Solution class are the bot's strategy, formatted as a dictionary with keys being Spots and values of the Advisor type. A Spot is, in a way, an extension of the poker situation, augmented with information about the hero's hand or the current stack. An Advisor is an interface for the puzzle pieces that make decisions in a specific spot.
An important service is selfplay. It provides the ability to play the created strategies against each other and export text hand histories to ClickHouse, from where they can later be imported into third-party game analysis tools.