Fix player rotation bug when all players are in bypass#331
Open
NikVince wants to merge 1 commit intodatamllab:masterfrom
Open
Fix player rotation bug when all players are in bypass#331NikVince wants to merge 1 commit intodatamllab:masterfrom
NikVince wants to merge 1 commit intodatamllab:masterfrom
Conversation
When a betting round ends in no-limit hold'em, the game_pointer was being reset unconditionally to (dealer_id + 1) % num_players. If all players were in bypass (folded or all-in), the skip loop wouldn't execute, leaving game_pointer at an incorrect value that could cause the same player to act multiple times in a row. This fix ensures that game_pointer is only reset when there are active players. If all players are in bypass, the game_pointer from proceed_round() is preserved, allowing the game ending logic to handle it correctly. Fixes issue where Player 0 (or any player) could act multiple times consecutively after a round ends when all players are in bypass state. Changes: - Modified step() method to conditionally reset game_pointer only when there are active players (sum(players_in_bypass) < num_players) - Added comprehensive tests to verify player rotation works correctly across different dealer positions and round transitions Tested: - Added test_player_rotation_no_duplicate_actions() to ensure no player acts twice in a row within the same round - Added test_player_rotation_round_transition() to verify correct rotation when rounds end across all dealer positions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When a betting round ends in no-limit hold'em, the game_pointer was being reset unconditionally to (dealer_id + 1) % num_players. If all players were in bypass (folded or all-in), the skip loop wouldn't execute, leaving game_pointer at an incorrect value that could cause the same player to act multiple times in a row.
This fix ensures that game_pointer is only reset when there are active players. If all players are in bypass, the game_pointer from proceed_round() is preserved, allowing the game ending logic to handle it correctly.
Fixes issue where Player 0 (or any player) could act multiple times consecutively after a round ends when all players are in bypass state.
Changes:
Tested: