Skip to content

Commit

Permalink
⛔ Remove outdated instructions. New oones are to be added soon
Browse files Browse the repository at this point in the history
  • Loading branch information
Skripkon committed Jan 4, 2025
1 parent 64d37c5 commit 2ba0eee
Showing 1 changed file with 8 additions and 35 deletions.
43 changes: 8 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
"""
Expand All @@ -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()
Expand Down

0 comments on commit 2ba0eee

Please sign in to comment.