Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 87e51d4bc6 |
+3
-12
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user