From 2ba0eee73d5341222b77bfde7419c3bcaced796b Mon Sep 17 00:00:00 2001 From: Nikolay Date: Sat, 4 Jan 2025 14:10:55 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9B=94=20Remove=20outdated=20instructions.?= =?UTF-8?q?=20New=20oones=20are=20to=20be=20added=20soon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 43 ++++++++----------------------------------- 1 file changed, 8 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 76a94ea..1c196ad 100644 --- a/README.md +++ b/README.md @@ -37,12 +37,12 @@ If you want to see a detailed output during the games, then set ```verbose=True` 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. +- 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. ```python from PokerBots import BasePlayer -class NewBot(BasePlayer): +class MyOwnBot(BasePlayer): def play(self, valid_actions: dict[str], state) -> tuple[str, float]: """ @@ -51,45 +51,18 @@ class NewBot(BasePlayer): pass ``` -> [!IMPORTANT] -> ```state``` has the following format: - -``` - state = { - "action": - { - "fold": 0, - "call": 20, - "check": -1, - "raise": - { - "min": 20, - "max": 100 - } - } - "board": list[Card] - } -``` - -> [!NOTE] -> Value **-1** indicates that the action is invalid. Otherwise, it's an amount of chips. Fold is always valid. - **Now you can use this bot:** ```python -from PokerBots import Game, RandomPlayer - -# Create a new table -game = Game(small_blind=10) +from PokerBots import Game -# Create two random players -random_bot = RandomPlayer(stack=5_000, name="Igor") -my_bot = NewBot(stack=10_000, name="Ivan") +# Define two vanila players and one of your own +player1 = MyOwnBot(name="Igor") +player2 = CallingBot(name="Ivan") +player3 = CallingBot(name="Ivan") -# Add these players to the table just created -game.set_player_1(player=random_bot) -game.set_player_2(player=my_bot) +game = Game(players=[player1, player2, player3], stack=30_000, n_players=n_players) # Run 1 round game.play_round()