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
BasePlayerclass. - Override the
playmethod: 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_actionsis 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)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pokerbots-2.0.6.tar.gz | 10.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|
Security for PokerBots 2.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.