From 291d304ac7da414c74119017b60d74349ea62ee2 Mon Sep 17 00:00:00 2001 From: Rhys Lloyd Date: Mon, 18 May 2026 12:41:12 -0700 Subject: [PATCH] seed from cli argument --- klondike-cli/src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/klondike-cli/src/main.rs b/klondike-cli/src/main.rs index 973939d..74ca1af 100644 --- a/klondike-cli/src/main.rs +++ b/klondike-cli/src/main.rs @@ -257,7 +257,12 @@ fn get_good_move(state: &Klondike) -> Option { fn main() -> Result<(), std::io::Error> { use rand::RngExt; let mut rng = rand::rng(); - let mut seed = rng.random(); + // seed from cli argument + let mut seed = if let Some(seed) = std::env::args().skip(1).next() { + seed.parse().expect("Invalid u64 seed") + } else { + rng.random() + }; let mut session = Session::new_default(Klondike::with_seed(seed)); let mut input = String::new(); loop {