feat(core): take-from-foundation house rule
Add `GameState::take_from_foundation` flag (default false). When off, Foundation→Tableau moves are blocked at the core rule layer. When on, the top card of a foundation pile may be moved back to a compatible tableau column (one card at a time). Wire the matching `Settings::take_from_foundation` field through `handle_new_game` so the player's preference applies to every new deal. Four targeted tests cover: blocked-by-default, allowed-when-enabled, illegal-tableau-placement, and count>1 rejection. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -237,6 +237,12 @@ pub struct Settings {
|
||||
/// field existed deserialize cleanly to `None` via `#[serde(default)]`.
|
||||
#[serde(default)]
|
||||
pub leaderboard_display_name: Option<String>,
|
||||
/// When `true`, the player may drag the top card of a completed foundation
|
||||
/// pile back onto a compatible tableau column — a non-standard house rule.
|
||||
/// Off by default. Older `settings.json` files deserialize cleanly to
|
||||
/// `false` via `#[serde(default)]`.
|
||||
#[serde(default)]
|
||||
pub take_from_foundation: bool,
|
||||
}
|
||||
|
||||
fn default_draw_mode() -> DrawMode {
|
||||
@@ -357,6 +363,7 @@ impl Default for Settings {
|
||||
replay_move_interval_secs: default_replay_move_interval_secs(),
|
||||
last_difficulty: None,
|
||||
leaderboard_display_name: None,
|
||||
take_from_foundation: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user