games.poker.example¶
Example poker game demonstrating the Haive poker implementation.
This module provides a comprehensive example of running a poker game with AI-powered players using the Haive framework. It demonstrates:
Creating and configuring poker agents with different playing styles
Running a complete poker game with betting rounds
Rich terminal UI with card visualization
Hand evaluation and winner determination
Game state tracking and analysis
The example supports various poker configurations including different numbers of players, starting chips, blind structures, and AI strategies.
- Usage:
- Basic game:
$ python example.py
- Custom configuration:
$ python example.py –players 6 –chips 1000 –blinds 10 20
- With specific AI strategies:
$ python example.py –strategies aggressive conservative balanced random
Examples
>>> # Run a basic 4-player game
>>> from haive.games.poker.example import run_poker_game
>>> run_poker_game(num_players=4, starting_chips=1000)
Functions¶
|
Create a poker agent config from command line args. |
|
Format a card with unicode symbols. |
|
Get the poker position name. |
|
Launch the poker game in a separate terminal window. |
|
Main. |
|
Run the game with rich UI visualization. |
|
Run the game with text-only visualization. |
Helper function to update all UI components. |
|
|
Visualize the current game state in a human-readable format. |
Module Contents¶
- games.poker.example.create_config_from_args(args, player_names)¶
Create a poker agent config from command line args.
- games.poker.example.format_card(card)¶
Format a card with unicode symbols.
- Parameters:
- Return type:
- games.poker.example.get_position_name(position, num_players)¶
Get the poker position name.
- games.poker.example.launch_in_separate_window(args, player_names)¶
Launch the poker game in a separate terminal window.
- games.poker.example.main()¶
Main.
- games.poker.example.run_rich_ui_game(config, player_names, delay, max_hands=None)¶
Run the game with rich UI visualization.
- games.poker.example.run_text_game(config, delay)¶
Run the game with text-only visualization.
- games.poker.example.update_ui()¶
Helper function to update all UI components.
- games.poker.example.visualize_game_state(game_state)¶
Visualize the current game state in a human-readable format.