fix: update kuhnpoker env #103
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request focuses on improving the logic and robustness of the Kuhn Poker environment in
textarena/envs/KuhnPoker/env.py
. The changes address several issues, including incorrect game state handling, winner determination, and round transitions, while also adding safeguards to prevent errors during gameplay.Game state and logic fixes:
current_round
in thereset
method to start from 0 instead of 1._init_round
to compare the correct chip counts for each player._init_round
to return immediately after setting the game as a draw or declaring a winner, avoiding further processing.Gameplay flow improvements:
step
method to immediately return if the game is already marked as done, ensuring no further actions are processed.step
method to prevent callingself.state.step()
after round-ending actions, avoiding player-switching issues.Round and game-ending logic:
_set_round_winner
to directly end the game and declare a winner if the maximum number of rounds is reached, instead of waiting for another action.Miscellaneous:
_handle_showdown
to useta.GAME_ID
as the sender ID for observations, ensuring consistency in game messages.