Upload your bot, get it reviewed, and compete in tournaments!
Copy this template and modify the get_action method to implement your strategy:
from bot_api import PokerBotAPI, PlayerAction
from engine.poker_game import GameState
from engine.cards import Card
from typing import List, Dict, Any
class MyBot(PokerBotAPI):
"""
Your custom poker bot
"""
def __init__(self, name: str):
super().__init__(name)
# Add any initialization here
self.hands_played = 0
def get_action(self, game_state: GameState, hole_cards: List[Card],
legal_actions: List[PlayerAction], min_bet: int, max_bet: int):
"""
Decide what action to take
Args:
game_state: Current game state (pot, community cards, etc.)
hole_cards: Your two hole cards
legal_actions: List of actions you can take
min_bet: Minimum bet amount for raises
max_bet: Maximum you can bet (your chips + current bet)
Returns:
tuple: (PlayerAction, amount)
"""
# Example: Simple strategy - always call if possible
if PlayerAction.CALL in legal_actions:
return PlayerAction.CALL, 0
if PlayerAction.CHECK in legal_actions:
return PlayerAction.CHECK, 0
return PlayerAction.FOLD, 0
def hand_complete(self, game_state: GameState, hand_result: Dict[str, Any]):
"""
Called when a hand is complete
Use this to learn from results
"""
self.hands_played += 1
if 'winners' in hand_result and self.name in hand_result['winners']:
self.logger.info(f"Won hand #{self.hands_played}!")
In your get_action method, you have access to:
game_state.pot - Current pot sizegame_state.community_cards - Cards on the tablegame_state.current_bet - Current bet to matchgame_state.player_chips - Everyone's chip countsgame_state.round_name - "preflop", "flop", "turn", or "river"hole_cards - Your two private cardslegal_actions - What you can do (FOLD, CHECK, CALL, RAISE, ALL_IN)PokerBotAPIget_action and hand_complete