refactor(core): align Spider with upstream card_game idioms
Test / test (pull_request) Successful in 37m4s
Test / test (pull_request) Successful in 37m4s
Addresses upstream author review of the Spider core (PR #157): - RNG: drop the hand-rolled SplitMix64 + Fisher-Yates; deals now use rand::rngs::StdRng seeded via seed_from_u64 + SliceRandom::shuffle, exactly like klondike::with_seed. solitaire_core gains the same pinned rand dep klondike uses (0.10.1, std_rng only — already in the lock, no new transitive deps). Deals for a given seed change; Spider has no persisted games yet, so nothing breaks. - Enums over integers: pile indices and card counts in the instruction type are now SpiderTableau (Tableau1..Tableau10, with an ALL const) and RunLength (Run1..Run13); out-of-range piles and zero-card moves are unrepresentable. Rank comparisons use Rank::checked_add instead of u8 arithmetic. - Fixed-size containers: build_deck returns Stack<104> instead of Vec<Card>; possible_instructions is a const-iterated SpiderIter + validity filter (klondike's KlondikeIter pattern) instead of collecting into a Vec. - Upstream naming: SpiderGame -> Spider (matches Klondike), tableau_face_up/_down -> tableau_face_up_cards/_down_cards, stock_len -> stock() accessor, with_rng added alongside with_seed. - Solver access: SpiderGameState now exposes session(), the same escape hatch GameState has — the wrapper no longer pretends to hide solve(), which SessionConfig budgets already gate. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,11 @@ serde = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
klondike = { workspace = true }
|
||||
card_game = { workspace = true }
|
||||
# Deliberately NOT the workspace rand (0.9): this pins the exact dep the
|
||||
# upstream `klondike` crate uses, so `SeedableRng`/`SliceRandom` resolve
|
||||
# against the same crate version as `klondike::Rng` and Spider deals go
|
||||
# through the identical shuffle stack as Klondike deals.
|
||||
rand = { version = "0.10.1", default-features = false, features = ["std_rng"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
Reference in New Issue
Block a user