From 8f3689761d8330d9692dd6d69f6e808d64c2e127 Mon Sep 17 00:00:00 2001 From: funman300 Date: Tue, 19 May 2026 15:44:04 -0700 Subject: [PATCH] fix(core): make take_from_foundation true by default across all clients MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The flag was modelled as an opt-in non-standard rule but moving a card off a foundation is in fact standard Klondike — disabling it is the non-standard variant. Changing the core default to true means every client (desktop, Android, web) gets correct behaviour without each having to independently patch the value after construction. Clients that expose a settings toggle (desktop/Android) can still disable it through SettingsResource. - game_state.rs: flip default from false → true in new_with_mode - game_state.rs: rename/update take_from_foundation_disabled_by_default test to reflect the new intended default - solitaire_wasm/lib.rs: remove now-redundant override in new() (from_saved keeps its override to fix old saves that serialised false) Co-Authored-By: Claude Sonnet 4.6 --- solitaire_core/src/game_state.rs | 6 +++--- solitaire_wasm/src/lib.rs | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/solitaire_core/src/game_state.rs b/solitaire_core/src/game_state.rs index 8b26a14..1c0c18a 100644 --- a/solitaire_core/src/game_state.rs +++ b/solitaire_core/src/game_state.rs @@ -193,7 +193,7 @@ impl GameState { is_auto_completable: false, undo_count: 0, recycle_count: 0, - take_from_foundation: false, + take_from_foundation: true, schema_version: GAME_STATE_SCHEMA_VERSION, undo_stack: VecDeque::new(), } @@ -1408,9 +1408,9 @@ mod tests { } #[test] - fn take_from_foundation_disabled_by_default() { + fn take_from_foundation_enabled_by_default() { let g = setup_take_from_foundation_game(); - assert!(!g.take_from_foundation, "take_from_foundation is off by default (non-standard rule)"); + assert!(g.take_from_foundation, "take_from_foundation is on by default (standard Klondike rule)"); } #[test] diff --git a/solitaire_wasm/src/lib.rs b/solitaire_wasm/src/lib.rs index 7cf436d..2eef52a 100644 --- a/solitaire_wasm/src/lib.rs +++ b/solitaire_wasm/src/lib.rs @@ -366,10 +366,9 @@ impl SolitaireGame { } else { DrawMode::DrawOne }; - let mut game = GameState::new_with_mode(seed as u64, dm, GameMode::Classic); - // The web client has no settings layer; enable standard Klondike rule unconditionally. - game.take_from_foundation = true; - SolitaireGame { game } + SolitaireGame { + game: GameState::new_with_mode(seed as u64, dm, GameMode::Classic), + } } /// Full pile snapshot as a JS object.