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

fix: random agent can go all-in if possible #165

Merged
merged 2 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ A python package for Texas Hold 'Em Poker providing

| Version Name | Latest Tag | Release Notes | Patch Notes | Documentation | Release Date | End Support Date |
| ------------ | ---------- | ------------- | ----------- | ------------- | ------------ | ---------------- |
| 0.7 | v0.7.2 | [Release Notes](https://github.com/SirRender00/texasholdem/releases/tag/v0.7.0) | [Patch Notes](https://github.com/SirRender00/texasholdem/releases/tag/v0.7.2) | [Documentation](https://texasholdem.readthedocs.io/en/0.7/) | 16 April 2022 | |
| 0.6 | v0.6.5 | [Release Notes](https://github.com/SirRender00/texasholdem/releases/tag/v0.6.0) | [Patch Notes](https://github.com/SirRender00/texasholdem/releases/tag/v0.6.5) | [Documentation](https://texasholdem.readthedocs.io/en/0.6/) | 24 March 2022 | |
| 0.5 | v0.5.3 | [Release Notes](https://github.com/SirRender00/texasholdem/releases/tag/v0.5.0) | [Patch Notes](https://github.com/SirRender00/texasholdem/releases/tag/v0.5.3) | [Documentation](https://texasholdem.readthedocs.io/en/0.5/) | 21 March 2022 | |
| 0.7 | v0.7.3 | [Release Notes](https://github.com/SirRender00/texasholdem/releases/tag/v0.7.0) | [Patch Notes](https://github.com/SirRender00/texasholdem/releases/tag/v0.7.3) | [Documentation](https://texasholdem.readthedocs.io/en/0.7/) | 16 April 2022 | |

Current Roadmap \
[v1.0.0](https://github.com/SirRender00/texasholdem/wiki/Version-1.0.0-Roadmap)
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
author = 'Evyn Machi'

# The full version, including alpha/beta/rc tags
release = 'v0.7.2'
release = 'v0.7.3'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "texasholdem"
version = "0.7.2"
version = "0.7.3"
description = "A texasholdem python package"
authors = ["Evyn Machi <evyn.machi@gmail.com>"]
keywords = ['texasholdem', 'holdem', 'poker']
Expand Down
6 changes: 5 additions & 1 deletion texasholdem/agents/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ def random_agent(game: TexasHoldEm, no_fold: bool = False) -> Tuple[ActionType,
possible.remove(ActionType.CHECK)

# not enough chips to raise
if max_raise < min_raise:
if not game.raise_option:
possible.remove(ActionType.RAISE)
elif max_raise < min_raise:
possible.remove(ActionType.RAISE)
if chips:
possible.append(ActionType.ALL_IN)

action_type, total = random.choice(possible), None
if action_type == ActionType.RAISE:
Expand Down