Add Phase 10 game#230
Open
odium1963 wants to merge 11 commits intoXGDevGroup:mainfrom
Open
Conversation
941767a to
d4c9567
Compare
…ged label - Prevent a card already committed to a prior lay-down group from being selected again in a subsequent group; speaks an error message instead. - _get_card_label now shows "(staged)" for committed cards so they are visually distinct from unselected cards in the menu. - Added phase10-card-label-staged and phase10-lay-down-card-already-staged locale keys. - Rename game directory from phase_10 to phase10 (no underscore) to match project conventions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…flow
Evaluator:
- resolve_run_order: assign values to run cards (wilds fill gaps then extend low)
- can_hit_group: naturals must extend run at ends only; wilds rejected if run
already spans 1-12
Game:
- Positional card action IDs (card_1..N on sorted hand) replacing card_{card.id}
- _sorted_hand_for_menu: sorts with staged cards at bottom during lay-down
- hit_wild_group_idx flow: when a wild hits a run, prompt for low/high placement
- discard_pending_card_id: two-step discard (select card, then confirm via J)
- hand_sort field + sort-by-color / sort-by-number keybinds (Shift+C / Shift+H)
- check_requirement action during lay-down (reads current group spec aloud)
- skip_targets_this_hand renamed to skip_targets_this_round
- _format_group_summary: table groups show run range / set rank / color count
- _suppress_keybind_rebuild for read-only info actions
- draw/lay-down/hit actions hidden from turn menu (keybind-only)
- Humans seated before bots on first hand
- Skip target labels include phase number
- game_winner_id tracked for build_game_result
Bot:
- Uses _card_action_id for positional card selection
- Wild placement: resolve_run_order decides low vs high
- _choose_discard avoids feeding table groups; sets discard_pending_card_id directly
FTL: wild placement prompts, group summaries, discard action labels, deck count,
check-requirement, skip-target label, various wording cleanups
Tests: test_phase10.py, test_phase10_evaluator.py (new)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers card types, all 10 phases, scoring, turn structure, lay-down and hit mechanics, discard flow, winning conditions, all game options, keyboard shortcuts, and strategy tips. Modelled on the backgammon rules document. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ction Two corrections verified against game.py: 1. Hitting: pressing Enter on a hand card when phase is laid down and groups exist enters hit mode directly (no H required). H is an alternative that lets you enter hit mode first, then choose a card. 2. Discarding: _action_do_discard falls back to the focused menu item when no discard_pending_card_id is set, so J discards the focused card without a prior Enter selection step. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The global escape → cancel keybind shadowed the platform's escape → show_actions keybind for the entire game, making the actions menu unreachable via backspace. Cancel actions are already the first turn-menu item on mode entry (rebuild_player_menu always passes position=1), so screen reader focus lands on cancel immediately. Cancel is also listed in the actions menu. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…und scoring Instead of scheduling timed broadcasts (which race against each player's screen reader speech rate), show each player a personalised status box with the full round summary. Players read at their own pace and dismiss when ready; the next round starts independently via next_round_wait_ticks. Also removes the scheduled-broadcast test that tested the now-removed platform feature. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds Action.skip_menu_rebuild (default False). When every action fired by a keybind opts in, the post-keybind rebuild_all_menus call is skipped. Applied to check_scores and check_scores_detailed so pressing S no longer resets menu cursor focus. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… actions; simplify score format - C (read table groups) and shift+S (detailed scores) now open a status box instead of speaking a joined one-liner - E (read counts) and other read-only info actions speak inline as one-liners, consistent with the rest of the codebase - Score entry drops verbose "penalty points" suffix: now just "Player: Phase N, 123" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace hardcoded " and " with Localization.format_list_and in _commit_lay_down - Suppress keybind rebuild in _action_read_table when table groups are present - Route _handle_turn_timeout through self.bot_think for consistent dispatch - Collapse Skip hit branches into single phase10-hit-invalid-skip reason key - Remove always-true second condition from _pick_set list comprehension - Remove dead prev_rank variable from _pick_run - Add phase10-hit-invalid-skip FTL key; remove five orphaned FTL keys Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
a51a6ed to
493f6fb
Compare
… stray PDF - Guard game_active = True in _end_round with `if not game_over` so finish_game()'s game_active = False is not immediately overridden; game loop now exits cleanly instead of running to max_ticks - _action_read_hand now uses _sorted_hand_for_menu so spoken card order matches what the player sees in the menu - Remove Phase-10-rules-printable.pdf from repo root (rules already live in server/documents/shared/phase10_rules/en.md) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Adds a full implementation of Phase 10 for PlayPalace.
What's included
games/phase10/): full turn loop, lay-down mode, hit mode, skip flow, wild placement on runs, tiebreaker, fixed-hands variant, even-phases variantevaluator.py): set/run/color validation,can_hit_group,resolve_run_orderfor wild placement and group displaybot.py): phase-aware discard strategy, hit targeting, wild placement, skip targetingstate.py): all 10 phase definitions, player state, all four game options (winning phase, turn timer, even phases, fixed hands)locales/en/phase10.ftl): complete English locale filedocuments/shared/phase10_rules/en.md): full player-facing rules covering card types, all phases, turn structure, keyboard shortcuts, and strategy tipstests/test_phase10.py,tests/test_phase10_evaluator.py)Keybinds
Space (draw deck), Shift+D (draw discard), N (lay down), Enter on card (hit), H (hit browse-first), J (discard focused card), F (confirm group), Escape (cancel), D (read discard), C (read table), P (phase status), E (card counts), Shift+C/H (sort hand), S (scores)
Test plan
cd server && uv run cli.py ...--serializeflag passes without errorsuv run pytest server/tests/test_phase10.py server/tests/test_phase10_evaluator.py🤖 Generated with Claude Code