Repository navigation
fix(game): don't freeze group games when the next player has blackjack - #115
Merged
Merged
Conversation
…ackjack When a player's turn ended and the next player had been dealt a natural 21, players_turn called next_player() again. That re-ran the "is it your turn?" check against the user who pressed the button, which failed, so the skip never happened and the game was stuck without a keyboard. Split the turn advancement into _advance_turn(), which players_turn uses for automatic skips, and keep the permission check in next_player() for button presses only. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KouGQtM6VBedfBdNr8WFX5
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.
Requested by Rico · project thread
Before: in a group game, the game could freeze when one player pressed Stand (or busted) and the next player had been dealt a blackjack. The bot posted the next player's cards without buttons and answered the person who pressed the button with "It's not your turn". After that nobody could continue until the stale-game cleaner removed the game.
After: the player with the blackjack is skipped automatically and play moves on to the next player, or to the dealer.
The automatic skip in
players_turncallednext_player(), which checks that the user who triggered the update is the current player. During an auto-skip, the triggering user is the previous player, so that check always failed.How: the turn-advancing logic now lives in
_advance_turn(), which runs no permission check.players_turnuses it for automatic skips.next_player()keeps the "is it your turn?" check for real button presses and then calls_advance_turn(). I added a regression test (test_next_player_skips_player_with_blackjack). It fails without the fix and passes with it, and the full suite passes on Python 3.11.🤖 Generated with Claude Code
https://claude.ai/code/session_01KouGQtM6VBedfBdNr8WFX5
Generated by Claude Code