take_from_foundation defaults to true but is documented as "Off by default" #13

Closed
opened 2026-05-19 18:43:04 +00:00 by funman300 · 0 comments
Owner

File

solitaire_core/src/game_state.rs lines 149–152, 196

Description

The field comment reads: "Off by default — non-standard house rule." However new_with_mode initialises it to true, enabling foundation-to-tableau moves for every new game unconditionally.

Additionally, #[serde(default)] on a bool deserialises missing values as false, so games saved before this field existed load with take_from_foundation = false while fresh games have true. Loaded and new games silently behave differently.

Fix

Change the initial value to false to match the documented intent, or change the doc comment and make the field opt-in explicitly.

## File `solitaire_core/src/game_state.rs` lines 149–152, 196 ## Description The field comment reads: *"Off by default — non-standard house rule."* However `new_with_mode` initialises it to `true`, enabling foundation-to-tableau moves for every new game unconditionally. Additionally, `#[serde(default)]` on a `bool` deserialises missing values as `false`, so games saved before this field existed load with `take_from_foundation = false` while fresh games have `true`. Loaded and new games silently behave differently. ## Fix Change the initial value to `false` to match the documented intent, or change the doc comment and make the field opt-in explicitly.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#13