-
Notifications
You must be signed in to change notification settings - Fork 202
Open
Description
When the players remaining stack is too low for the minimal raise (defined by the call amount + the last raise performed on the street), -1 is given by valid_actions, though if the player has more than the call amount, he should be able to raise to that value (to go all-in)
To fix this, I changed the function legal_actions in engine/action_checker.py to:
def legal_actions(self, players, player_pos, sb_amount):
min_raise = self.__min_raise_amount(players, sb_amount)
max_raise = players[player_pos].stack + players[player_pos].paid_sum()
if max_raise < min_raise:
min_raise = max_raise = -1
if self.agree_amount(players)>=max_raise:
min_raise = max_raise = -1
else:
min_raise = max_raise = players[player_pos].stack + players[player_pos].paid_sum()
return [
{ "action" : "fold" , "amount" : 0 },
{ "action" : "call" , "amount" : self.agree_amount(players) },
{ "action" : "raise", "amount" : { "min": min_raise, "max": max_raise } }
]
Now if the player has a stack smaller than the call amount, -1 is still returned and the player can just call, but when the player's stack is larger than the call amount, his all-in amount is returned.
Metadata
Metadata
Assignees
Labels
No labels