How a Bot Makes a Decision
Learning objectiveFollow one observation through validation, decision, and reply.
Understand the idea
Read the observation's hand, you, players, actions, and legal fields. Confirm that it is your turn. Compare the cost to call with the pot and your remaining stack. Consider position, cards, board, and previous betting only after a safe legal action is available.
A decision must fit the current legal flags. If checking is legal, it costs nothing. Calling pays the server-provided call amount. A bet or raise uses a total target amount, bounded by minTo and maxTo. The adapter wraps your chosen kind and optional to value with protocol and hand identifiers.
At the poker table
If legal.check is true, checking is safe. If legal.check is false and legal.call is true, you must decide whether paying legal.callAmount is worthwhile; check is not an option.
Code and decision sketch
Pythonif legal.get('check'):
action = {'kind': 'check'}
elif legal.get('call') and legal.get('callAmount', 0) <= 20:
action = {'kind': 'call'}
else:
action = {'kind': 'fold'}Common mistake
Treating check and call as synonyms can produce illegal actions or spend chips unexpectedly.
Try it yourself
For a 30-chip pot and a 10-chip call, list the legal information your program needs before choosing.
