Rule-Based Bots
Learning objectiveTurn explicit poker conditions into a testable decision order.
Understand the idea
A rule-based bot uses ordered if/else conditions. Start with legal-action validation, then apply hand, position, and price rules. Rules are transparent and fast, making them excellent for a first working bot. Their weakness is brittleness: a fixed threshold may ignore opponent range or changing board texture.
Keep a safe fallback after the strategic rules. When two rules disagree, their order determines which wins. Write tests for overlapping conditions so a strong-hand branch does not accidentally submit an illegal raise.
At the poker table
Raise a selected preflop hand only when raise is legal and minTo fits the stack; otherwise call within a price cap, then check or fold.
Code and decision sketch
Pseudocodeif premium(hole) and legal.raise:
return {'kind':'raise','to':legal.minTo}
if legal.check: return {'kind':'check'}
if legal.call and legal.callAmount <= price_cap: return {'kind':'call'}
return {'kind':'fold'}Common mistake
A rule's intent does not override legal flags. Check actual legal.minTo before choosing a raise.
Try it yourself
Write two conflicting rules and choose a deliberate priority order.
