Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
schreven opened this issue Jun 11, 2019 · 5 comments
Open

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

schreven opened this issue Jun 11, 2019 · 5 comments

Comments

@schreven
Copy link

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.

@alexyalunin
Copy link

@schreven according to prev issues I assume you have the latest updates, could you please share your branch?

@schreven
Copy link
Author

Glad to see someone else is active with this repository.
Here is the fork. I added a readme describing the changes I made.
A few notes: I've not been thorough on the first commit titles. There are some added options that I use for my project, they are not active by default. The only change that may affect you is if you use blind structures, they are updated differently now. Will put that as an option in the future. An issue I have not fixed is that the winner is determined by 7 cards, though it should be only 5.
I've tried to be precise but if you see an issue, let me know!

@allenfrostline
Copy link

@schreven I encountered the same issue and fixed it similar to what you did. Hope that can be merged in the official repo soon.

@110503
Copy link

110503 commented Jan 18, 2020

I'm glad to see that this project is not dead. Good work.

@schreven
Copy link
Author

Thanks! It's just a shame that the repository owner is not active anymore. If more people still use this project, it can be worthwhile to maintain a fork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants