Skip to main content


Test your bots in no-limit hold'em tournaments!

1. Install the library

$ pip install PokerBots

2. Explore a simple example

from PokerBots import Game, CallingPlayer, RandomPlayer, GamblingPlayer

# Define three vanila players
player1 = GamblingPlayer(name="Igor")
player2 = CallingPlayer(name="Ivan")
player3 = RandomPlayer(name="Maria")

game = Game(players=[player1, player2, player3], initial_stack=30_000)

# See current stacks:
print(game.stacks)  # [30_000, 30_000, 30_000]

# Run 1 round
game.play_round(verbose=False)

# See stacks after one round:
print(game.stacks)  # [27500, 35000, 27500]

If you want to see a detailed output during the games, then set verbose=True.

3. Create Your Own Bot

Creating new bots is a straightforward process:

  • Inherit from the BasePlayer class.
  • Override the play method: it must return an action and the amount of chips to bet, given the state of the game and valid actions.
from PokerBots import BasePlayer
from pokerkit import State

class MyOwnBot(BasePlayer):

    def play(self, valid_actions: dict, state: State) -> tuple[str, float]:
        """
        Implement a strategy to choose an action.
        """
        pass

valid_actions is a dictionary. Keys represent valid actions, and values represent the valid amount of chips. If all actions are valid, it will look like this:

valid_actions["fold"] = 0
valid_actions["check_or_call"] = 1_000
valid_actions["complete_bet_or_raise_to"] = (1_000, 50_000)

valid_actions["complete_bet_or_raise_to"] is a tuple of two numbers: the minimum and maximum raises.

Other information can be obtained from the state parameter.

For instance, the cards on the board can be accessed as follows:

state.board_cards

Or, the player's hole cards:

state.hole_cards[state.actor_index]

All official bots can be found in PokerBots/players/

Any questions? Want to contribute or merely give my repo a star?

See the source code!

Metadata

Release files for PokerBots 2.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PokerBots 2.0.6
File Size Uploaded
pokerbots-2.0.6.tar.gz 10.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PokerBots 2.0.6
File Interpreter ABI Platform
PokerBots-2.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 20.5 kB

Release files / pokerbots-2.0.6.tar.gz

Download URL pokerbots-2.0.6.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1b60cb6bbf5df4378c789727b669b0b8ca27cc53024d52856666f0de2d7f86ec
BLAKE2b-256 checksum
How to use checksums
40e959620a94efa3d2383469e044891da87e39c7fc23118697fb245d507bf5eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Release files / PokerBots-2.0.6-py3-none-any.whl

Download URL PokerBots-2.0.6-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
55943f3dc127ecf2e03384405a1d51b0b8b2836450a86b3a4aba6d76b3e8769f
BLAKE2b-256 checksum
How to use checksums
008b918785d8e14de7f8f6505209563394bc4503ea8e17db736650bc2fc95dc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Release history Release notifications | RSS feed

This release

2.0.6 This release

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page