Skip to content

Commit

Permalink
Fixes minor history bug (#22)
Browse files Browse the repository at this point in the history
* Fixes minor history bug

- Fixes a bug where the last state was not returning in the
  import_history method.
  • Loading branch information
SirRender00 authored Feb 2, 2022
1 parent 254d990 commit ab1c18e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# texasholdem
A python package for Texas Hold 'Em Poker.

[Current Release Version v0.3.2](https://github.com/SirRender00/texasholdem/releases/tag/v0.3.2)
[Current Release Version v0.3.3](https://github.com/SirRender00/texasholdem/releases/tag/v0.3.3)

[v1.0.0 Roadmap](https://github.com/SirRender00/texasholdem/wiki/Version-1.0.0-Roadmap)

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.3.2"
version = "0.3.3"
description = "A texasholdem python package"
authors = ["Evyn Machi <evyn.machi@gmail.com>"]
keywords = ['texasholdem', 'holdem', 'poker']
Expand Down
5 changes: 4 additions & 1 deletion tests/game/test_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,8 @@ def test_file_naming(tmpdir, call_player):
with open(new_history, 'r') as f:
history_string = f.read()

last_history = ""
for state in TexasHoldEm.import_history(new_history):
assert history_string.strip().startswith(state.hand_history.to_string().strip())
last_history = state.hand_history.to_string()
assert history_string.strip().startswith(last_history.strip())
assert last_history.strip() == history_string.strip()
1 change: 1 addition & 0 deletions texasholdem/game/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,3 +920,4 @@ def import_history(path: Union[str, os.PathLike]) -> Iterator[TexasHoldEm]:
while game.is_hand_running():
yield game
game.take_action(*player_actions[game.current_player].pop(0))
yield game

0 comments on commit ab1c18e

Please sign in to comment.