games.hold_em.utils¶
Texas Hold’em utility functions.
- This module provides utility functions for the Hold’em game, including:
Card and hand evaluation
Game state utilities
Poker calculations
Functions¶
|
Calculate effective stack between two players. |
|
Calculate pot odds as a ratio. |
|
Convert card rank to numeric value for comparison. |
|
Extract suit from card. |
|
Count players with specific statuses. |
Create a standard 52-card deck. |
|
|
Deal cards from deck, returning (dealt_cards, remaining_deck). |
|
Simple hand evaluation (placeholder for production poker evaluator). |
|
Format cards for display with suit symbols. |
|
Format a summary of the current game state. |
|
Describe the board texture. |
|
Get the next active player starting from a position. |
|
Get position name based on seat and dealer position. |
|
Check if position is early. |
|
Check if position is late. |
|
Shuffle a deck of cards. |
|
Validate game state and return list of issues. |
Module Contents¶
- games.hold_em.utils.calculate_effective_stack(player, opponent)¶
Calculate effective stack between two players.
- Parameters:
opponent (haive.games.hold_em.state.PlayerState)
- Return type:
- games.hold_em.utils.calculate_pot_odds(pot_size, bet_to_call)¶
Calculate pot odds as a ratio.
- games.hold_em.utils.card_to_rank_value(card)¶
Convert card rank to numeric value for comparison.
- games.hold_em.utils.card_to_suit(card)¶
Extract suit from card.
- games.hold_em.utils.count_players_in_phase(game_state, statuses)¶
Count players with specific statuses.
- Parameters:
game_state (haive.games.hold_em.state.HoldemState)
statuses (list[haive.games.hold_em.state.PlayerStatus])
- Return type:
- games.hold_em.utils.deal_cards(deck, num_cards)¶
Deal cards from deck, returning (dealt_cards, remaining_deck).
- games.hold_em.utils.evaluate_hand_simple(hole_cards, community_cards)¶
Simple hand evaluation (placeholder for production poker evaluator).
Returns hand rank, strength score, and description.
- games.hold_em.utils.format_cards(cards)¶
Format cards for display with suit symbols.
- games.hold_em.utils.format_game_summary(game_state)¶
Format a summary of the current game state.
- Parameters:
game_state (haive.games.hold_em.state.HoldemState)
- Return type:
- games.hold_em.utils.get_board_texture_description(community_cards)¶
Describe the board texture.
- games.hold_em.utils.get_next_active_player(game_state, start_position)¶
Get the next active player starting from a position.
- Parameters:
game_state (haive.games.hold_em.state.HoldemState)
start_position (int)
- Return type:
int | None
- games.hold_em.utils.get_position_name(position, num_players, dealer_pos)¶
Get position name based on seat and dealer position.
- games.hold_em.utils.is_position_early(position, num_players, dealer_pos)¶
Check if position is early.
- games.hold_em.utils.is_position_late(position, num_players, dealer_pos)¶
Check if position is late.
- games.hold_em.utils.shuffle_deck(deck)¶
Shuffle a deck of cards.
- games.hold_em.utils.validate_game_state(game_state)¶
Validate game state and return list of issues.
- Parameters:
game_state (haive.games.hold_em.state.HoldemState)
- Return type: