refactor(core): integrate card_game/klondike deps cleanly
Wire card_game 0.4.0 and klondike 0.3.0 as workspace deps in solitaire_core and clean the integration seam across five areas: - Move From<card_game::Suit/Rank> bridge impls out of card.rs and into klondike_adapter.rs so the product-type module is upstream-dep-free - Add `use crate::card` alias to adapter; rename card_from_kl parameter to avoid shadowing; correct score_for_undo doc (it is Ferrous policy, not an upstream default — the solver explicitly passes undo_penalty=0) - Mark Pile as a read-only projection / data-transfer type in its doc comment so game logic isn't accidentally routed through it - Add GameState::session() read accessor exposing the underlying Session<Klondike> for replay history and solver use by external crates; update solver.rs to use the accessor instead of the pub(crate) field - Re-export Foundation, Klondike, KlondikePile, Session, Tableau from solitaire_core::lib so downstream crates (engine, wasm) can import from one place without a direct klondike/card_game dep - Add proptest property tests: card conservation (52 unique IDs always present), deal determinism, undo pile-layout invariant, legal moves always succeed Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -874,6 +874,16 @@ impl GameState {
|
||||
pub fn compute_time_bonus(&self) -> i32 {
|
||||
scoring_time_bonus(self.elapsed_seconds)
|
||||
}
|
||||
|
||||
/// Read-only access to the underlying [`card_game::Session`] for this deal.
|
||||
///
|
||||
/// Exposes `session.history()` (deterministic replay) and `session.solve()`
|
||||
/// (DFS solver) to crates outside `solitaire_core` without surfacing the
|
||||
/// mutable field. Internal code that needs to mutate the session accesses
|
||||
/// the `pub(crate)` field directly.
|
||||
pub fn session(&self) -> &Session<Klondike> {
|
||||
&self.session
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user