The way raise is defined is troublesome
When I raise 5 chips, the amount should be this pot's raised value + 5, not just 5 chips. It's causing many errors and I printed out player info's and pots.raised

You can see in the image, player's actions do not map correctly to pot-raised amounts (when player 3 raised 1298 chips, one value in the list below should update to 1298 as the raised amounts) and I have no idea where to locate this bug. Thanks for the help in advance!
Yeah so that's actually by design. That is, RAISE 50 can be read as raise to 50. You can see that when player 3 raised 1298 chips, the total amount in the pots became 1298.
I do hear you though that it is way more intuitive to have the alternative. I'll add this in as a to do
A work around for now is that you can have a player raise the amount game.player_bet_amount(player_id) + game.chips_to_call(player_id) + raise_amount where raise_amount behaves as you describe.
Thank you for the reply! That's what I did using my agents, but as you can see in the screenshot above, pot.raised is not being calculated correctly and I have always been getting this:

Looks to be a bug with split pots. Those have been notoriously troublesome... What version are you on?
The latest version
It would be also be helpful if you can export the history of the hand with game.export_history and post that here. It will be useful to replicate what happened and add it to the test suite.
Looks like that when someone went all-in. It split the pot when it wasn't suppose to, probably has to do with the logic of when we split the pot here: https://github.com/SirRender00/texasholdem/blob/97e05f328413d8ead60a1d88c91d5ccf2ab559a9/texasholdem/game/game.py#L432-L437
Ok I can see about getting a fix on this. But getting that history file if you can will be most helpful in verifying it.
The Invalid move error is fixed after I changed to game.player_bet_amount(player_id) + game.chips_to_call(player_id) + raise_amount. But the pot is still behaving kinda weird:
I added this in the Pot class
def __repr__(self):
return {
"amount": self.amount,
"raised": self.raised,
"player_amounts": self.player_amounts,
"player_amounts_without_remove": self.player_amounts_without_remove,
}.__str__()
and the output looks like:
pots: [
{
"amount": 3000,
"raised": 0,
"player_amounts": {5: 0, 0: 0, 2: 0, 3: 0, 4: 0},
"player_amounts_without_remove": {
0: 500,
1: 500,
2: 500,
3: 500,
4: 2622,
5: 500,
},
},
{
"amount": 0,
"raised": 0,
"player_amounts": {4: 0, 0: 0, 2: 0, 3: 0},
"player_amounts_without_remove": {4: 2122, 0: 0, 1: 0, 2: 0, 3: 0},
},
{
"amount": 0,
"raised": 0,
"player_amounts": {4: 0, 2: 0, 3: 0},
"player_amounts_without_remove": {4: 2122, 1: 2122, 2: 0, 3: 0},
},
{
"amount": 0,
"raised": 0,
"player_amounts": {4: 0, 3: 0},
"player_amounts_without_remove": {4: 2122, 1: 2122, 3: 0},
},
{
"amount": 2122,
"raised": 0,
"player_amounts": {4: 0},
"player_amounts_without_remove": {4: 1061, 1: 1061},
},
]
I also added this player_amounts_without_remove that records player's bets in the entire game without resetting it. Seems like a lot of empty pots are added.
Here are some of the history files you've requested... history.zip
Sorry which of those files display abnormal behavior?
Sorry which of those files display abnormal behavior?
I don't think there're any more😂, just sometimes empty pots are added
Got it haha... if you find a case... just attach it here. Hopefully there's nothing huge then that's blocking you. As a very yucky solution at each step you can run
def cleaner(game):
pots_to_remove = []
for i, pot in enumerate(game.pots, 0):
if pot.get_total_amount() == 0:
for player in game.players:
if player.last_pot >= i:
player.last_pot -= 1
pots_to_remove.append(i)
game.pots = [pot for i, pot in enumerate(game.pots, 0) if i not in pots_to_remove]
~Once we find a case where there's empty pots we can work on this~ I'll split off a new issue actually and keep this as redefining the raise action https://github.com/SirRender00/texasholdem/issues/40 Once we find a case and a history file of this we can add it to the linked issue. The history file should have the empty pots in it since we do not delete pots at any point
Ok found a bunch actually, will continue this discussion in the other issue
- [x] Rename value to total and deprecate it for 1.0
- [ ] 1.0 Do the change and fix all the calls