feat(core): Spider rules as a second card_game::Game implementation #157

Merged
funman300 merged 1 commits from feat/spider-core into master 2026-07-07 23:40:44 +00:00
Owner

Spider-mode groundwork in solitaire_core, built on the upstream card_game containers — first real use of the multi-deck Deck variants and the Stack/Pile public API.

  • SpiderGame implements card_game::Game: 104-card two-deck deal (10 piles, 4×6+6×5, 50 in stock), build-down-any-suit, same-suit-run pickup, deal-10 gated on no empty pile, automatic K→A run removal with flip-up, win at 8 runs.
  • SpiderSuits (One/Two/Four) difficulty via Game::Config; Microsoft-style scoring (500 − moves + 100/run, undo penalty via the session).
  • SpiderGameState mirrors the Klondike GameState conventions: Result<_, MoveError> mutations (no new variants needed), session-owned undo/score.
  • Seeded deals via inline SplitMix64 + Fisher–Yates (no new core deps; documented as a Spider-local seed space).
  • 17 unit tests (incl. stacked win path, stock exhaustion) + a card-conservation proptest; crate at 70 tests green, clippy -D warnings, fmt clean.

Known follow-ups (documented in module docs): engine UI is a later phase; 1/2-suit games contain identical Card values, so a Spider UI needs positional entity keys; Session::solve deliberately not exposed for Spider (branching factor).

🤖 Generated with Claude Code

Spider-mode groundwork in `solitaire_core`, built on the upstream `card_game` containers — first real use of the multi-deck `Deck` variants and the `Stack`/`Pile` public API. - `SpiderGame` implements `card_game::Game`: 104-card two-deck deal (10 piles, 4×6+6×5, 50 in stock), build-down-any-suit, same-suit-run pickup, deal-10 gated on no empty pile, automatic K→A run removal with flip-up, win at 8 runs. - `SpiderSuits` (One/Two/Four) difficulty via `Game::Config`; Microsoft-style scoring (500 − moves + 100/run, undo penalty via the session). - `SpiderGameState` mirrors the Klondike `GameState` conventions: `Result<_, MoveError>` mutations (no new variants needed), session-owned undo/score. - Seeded deals via inline SplitMix64 + Fisher–Yates (no new core deps; documented as a Spider-local seed space). - 17 unit tests (incl. stacked win path, stock exhaustion) + a card-conservation proptest; crate at 70 tests green, clippy `-D warnings`, fmt clean. Known follow-ups (documented in module docs): engine UI is a later phase; 1/2-suit games contain identical `Card` values, so a Spider UI needs positional entity keys; `Session::solve` deliberately not exposed for Spider (branching factor). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
funman300 added 1 commit 2026-07-07 23:21:32 +00:00
Two-deck (104-card) Spider on the upstream Stack/Pile containers,
exercising the multi-deck Card encoding for the first time:

- SpiderGame: 10-pile deal (4x6 + 6x5), build-down-any-suit,
  same-suit-run pickup, deal-10 gated on no empty pile, automatic
  K->A run removal, win at 8 runs
- SpiderSuits difficulty (1/2/4 suits over the same 104 cards);
  1- and 2-suit games contain identical Card values by construction
  (documented — engine entity mapping will need positional keys)
- Seeded deals via inline SplitMix64 + Fisher-Yates (core has no
  rand dep; Spider's seed space is deliberately self-contained)
- SpiderGameState session wrapper mirroring GameState conventions:
  Result<_, MoveError> mutations, upstream undo/score bookkeeping,
  Microsoft-style scoring (500 base, -1/move, +100/run, -1/undo)
- 17 unit tests + card-conservation/validity proptest over random
  legal walks; stacked-deal win-path test included

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
funman300 merged commit 9e4d4a6716 into master 2026-07-07 23:40:44 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#157