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:
funman300
2026-05-12 23:16:54 -07:00
parent 859b69b3c5
commit af5ac68947
3 changed files with 94 additions and 0 deletions
+7
View File
@@ -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,
}
}
}