Skip to content

min_raise and max_raise = -1 when raise is still possible #72

@schreven

Description

@schreven

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions