1 Commits

Author SHA1 Message Date
Quaternions 87e51d4bc6 wip: fix instruction 2026-05-15 15:14:43 -07:00
+3 -12
View File
@@ -120,7 +120,6 @@ enum SessionInstruction {
New,
Undo,
Hint,
Auto,
Stock,
Klondike(KlondikeInstruction),
}
@@ -128,10 +127,9 @@ impl core::str::FromStr for SessionInstruction {
type Err = Invalid;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(match s {
"NEW" | "new" | "n" => Self::New,
"UNDO" | "undo" | "u" => Self::Undo,
"HINT" | "hint" | "h" => Self::Hint,
"AUTO" | "auto" | "a" => Self::Auto,
"NEW" | "new" => Self::New,
"UNDO" | "undo" => Self::Undo,
"HINT" | "hint" => Self::Hint,
"s" => Self::Stock,
other => {
let Parsed(ki) = other.parse()?;
@@ -164,13 +162,6 @@ fn main() -> Result<(), std::io::Error> {
println!("{instruction:?}");
}
}
SessionInstruction::Auto => {
if let Some(instruction) = session.possible_instructions().next() {
session.process_instruction(instruction);
} else {
println!("No valid moves!");
}
}
SessionInstruction::Stock => session.process_instruction(KlondikeInstruction::stock()),
SessionInstruction::Klondike(instruction) => {
if session.is_instruction_valid(instruction) {