Skip to content

Commit

Permalink
ensure agents are added before reset
Browse files Browse the repository at this point in the history
  • Loading branch information
dickreuter committed Feb 16, 2024
1 parent b493b13 commit e54add4
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
5 changes: 5 additions & 0 deletions gym_env/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ def reset(self):
self.funds_history = pd.DataFrame()
self.first_action_for_hand = [True] * len(self.players)

if not self.players:
log.warning("No agents added. Add agents before resetting the environment.")
return


for player in self.players:
player.stack = self.initial_stacks

Expand Down
34 changes: 33 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ cppimport = "^22.8.2"
docopt = "^0.6.2"
pydocstyle = "^6.3.0"
matplotlib = "^3.8.2"
mpld3 = "^0.5.10"


[build-system]
Expand Down
2 changes: 1 addition & 1 deletion readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Run:
- Install Poetry with ``curl -sSL https://install.python-poetry.org | python3 -``
- Create a virtual environment with ``poetry env use python3.11``
- Activate it with ``poetry shell``
- Install all required packages with ``poetry install``
- Install all required packages with ``poetry install --no-root``
- Run 6 random players playing against each other:
``poetry run python main.py selfplay random --render`` or
- To manually control the players:``poetry run python main.py selfplay keypress --render``
Expand Down

0 comments on commit e54add4

Please sign in to comment.