Getting Started#
The purpose of this section of the documentation is to get you onboarded with maverick as quick as possible. After having read this, you will have your first game played.
Installation#
You can install the library using pip on Python 3.12 or later by issuing the following command in your terminal:
pip install maverick
A minimal working example#
Playing a game consists of
Setting up players.
Configuring a game.
Playing the game.
There are ways to define custom players with their own behaviour and you will learn about how to do that in the User Guide. For now, we are going to define a Texas Hold’em game with a few simple bots from the library itself.
# Import necessary modules from the maverick library
from maverick import Game, PlayerLike, PlayerState
from maverick.players import FoldBot, CallBot, AggressiveBot
# Create game with blinds and max hands
game = Game(small_blind=10, big_blind=20, max_hands=10)
# Create and add players with different strategies
players: list[PlayerLike] = [
CallBot(name="CallBot", state=PlayerState(stack=1000)),
AggressiveBot(name="AggroBot", state=PlayerState(stack=1000)),
FoldBot(name="FoldBot", state=PlayerState(stack=1000)),
]
# Add players to the game
for player in players:
game.add_player(player)
# Start the game
game.start()
# Print final stacks of players after the game
for player in players:
print(f"{player.name} - Stack: {player.state.stack}")
# Announce winner
winner = max(players, key=lambda p: p.state.stack)
print(f"The winner is {winner.name} with a stack of {winner.state.stack}!")
CallBot - Stack: 730
AggroBot - Stack: 1380
FoldBot - Stack: 890
The winner is AggroBot with a stack of 1380!
Next Steps#
Well, the next logical step would be to learn how to win a game, but that’s not something we can teach you here. However, the library can be a valuable tool to experiment with different strategies and hone your skills ad we can teach you how to do that. If that’s something you are interested in, the recommended next move is to read the User Guide.