7a5f03987d
Review findings 1+2 (Quat-underuse lens, 2026-07-06):
- solitaire_core gains pub const FOUNDATIONS / TABLEAUS — the canonical
iteration source for the upstream pile enums (upstream klondike has no
Foundation::ALL, and inherent impls cannot be added to foreign types).
Deletes three identical private const-fn copies (radial_menu,
table_plugin, input_plugin) and the hand-enumerated variants in
card_plugin::sync::all_cards and solitaire_wasm.
- Hand-rolled [Suit; 4] / [Rank; 13] arrays replaced with upstream
Suit::SUITS / Rank::RANKS. The order-sensitive CardImageSet indexing
is re-keyed through canonical card_plugin::{suit_index, rank_index}
helpers that match upstream order, with regression tests asserting
the correspondence — one ordering everywhere instead of three
divergent local ones.
Net -177 lines. No behaviour change; all consumers go through the
canonical helpers.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
52 lines
1.9 KiB
Rust
52 lines
1.9 KiB
Rust
pub mod achievement;
|
|
pub mod error;
|
|
pub mod game_state;
|
|
pub mod klondike_adapter;
|
|
pub mod scoring;
|
|
|
|
// Re-export the upstream types that cross the solitaire_core API boundary so
|
|
// downstream crates (engine, wasm) can import from one place without a direct
|
|
// `klondike` / `card_game` dep.
|
|
//
|
|
// `KlondikePileStack`, `SkipCards` and `TableauStack` are intentionally NOT
|
|
// re-exported — they are only used internally (in `klondike_adapter.rs` and
|
|
// when decoding instructions to piles in `instruction_to_piles`) and do not
|
|
// appear in any public method signature.
|
|
pub use card_game::{Card, Deck, Rank, Session, SolveError, Suit};
|
|
pub use klondike::{DrawStockConfig, Foundation, Klondike, KlondikeInstruction, KlondikePile, Tableau};
|
|
|
|
// Solvability check API (delegates to `card_game::Session::solve`); replaces the
|
|
// former `solitaire_data::solver` wrapper module.
|
|
pub use game_state::{DEFAULT_SOLVE_MOVES_BUDGET, DEFAULT_SOLVE_STATES_BUDGET, SolveOutcome};
|
|
|
|
/// All four foundation slots, in slot order.
|
|
///
|
|
/// Canonical iteration source for `Foundation` — upstream `klondike` has no
|
|
/// `Foundation::ALL` (unlike `Suit::SUITS` / `Rank::RANKS` in `card_game`),
|
|
/// and inherent impls cannot be added to a foreign type, so the workspace
|
|
/// const lives here. Use this instead of hand-rolling `[Foundation; 4]`
|
|
/// arrays; scattered copies can silently diverge.
|
|
pub const FOUNDATIONS: [Foundation; 4] = [
|
|
Foundation::Foundation1,
|
|
Foundation::Foundation2,
|
|
Foundation::Foundation3,
|
|
Foundation::Foundation4,
|
|
];
|
|
|
|
/// All seven tableau columns, in column order (left to right on screen).
|
|
///
|
|
/// Canonical iteration source for `Tableau` — see [`FOUNDATIONS`] for why
|
|
/// this lives here rather than upstream.
|
|
pub const TABLEAUS: [Tableau; 7] = [
|
|
Tableau::Tableau1,
|
|
Tableau::Tableau2,
|
|
Tableau::Tableau3,
|
|
Tableau::Tableau4,
|
|
Tableau::Tableau5,
|
|
Tableau::Tableau6,
|
|
Tableau::Tableau7,
|
|
];
|
|
|
|
#[cfg(test)]
|
|
mod proptest_tests;
|