From 792c9acba3a5f63565ef748dfdfa8033ff3f3edf Mon Sep 17 00:00:00 2001 From: Rhys Lloyd Date: Fri, 15 May 2026 12:38:40 -0700 Subject: [PATCH] add new game command --- src/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.rs b/src/main.rs index 6cc45cd..c4002bc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -119,6 +119,7 @@ impl core::str::FromStr for Parsed { } enum SessionInstruction { + New, Undo, Hint, Klondike(KlondikeInstruction), @@ -127,6 +128,7 @@ impl core::str::FromStr for SessionInstruction { type Err = Invalid; fn from_str(s: &str) -> Result { Ok(match s { + "NEW" | "new" => Self::New, "UNDO" | "undo" => Self::Undo, "HINT" | "hint" => Self::Hint, other => { @@ -153,6 +155,7 @@ fn main() -> Result<(), std::io::Error> { // run game match instruction { + SessionInstruction::New => session = Session::new(Klondike::new_random_default()), SessionInstruction::Undo => session.undo(), SessionInstruction::Hint => { for instruction in session.possible_instructions() {