haive.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_config_from_args(args, player_names)

Create a poker agent config from command line args.

format_card(card)

Format a card with unicode symbols.

get_position_name(position, num_players)

Get the poker position name.

launch_in_separate_window(args, player_names)

Launch the poker game in a separate terminal window.

main()

Main.

run_rich_ui_game(config, player_names, delay[, max_hands])

Run the game with rich UI visualization.

run_text_game(config, delay)

Run the game with text-only visualization.

update_ui()

Helper function to update all UI components.

visualize_game_state(game_state)

Visualize the current game state in a human-readable format.

Module Contents¶

haive.games.poker.example.create_config_from_args(args, player_names)[source]¶

Create a poker agent config from command line args.

haive.games.poker.example.format_card(card)[source]¶

Format a card with unicode symbols.

Parameters:

card (haive.games.poker.models.Card)

Return type:

str

haive.games.poker.example.get_position_name(position, num_players)[source]¶

Get the poker position name.

Parameters:
  • position (int)

  • num_players (int)

Return type:

str

haive.games.poker.example.launch_in_separate_window(args, player_names)[source]¶

Launch the poker game in a separate terminal window.

haive.games.poker.example.main()[source]¶

Main.

haive.games.poker.example.run_rich_ui_game(config, player_names, delay, max_hands=None)[source]¶

Run the game with rich UI visualization.

haive.games.poker.example.run_text_game(config, delay)[source]¶

Run the game with text-only visualization.

haive.games.poker.example.update_ui()[source]¶

Helper function to update all UI components.

haive.games.poker.example.visualize_game_state(game_state)[source]¶

Visualize the current game state in a human-readable format.