From 6158043a609337095cd87934a25aa9d9328fae92 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Fri, 22 Mar 2024 22:21:51 +0000 Subject: [PATCH] automatic cargo CI changes --- src/bin/game/cli.rs | 9 +-------- src/game/mod.rs | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/bin/game/cli.rs b/src/bin/game/cli.rs index a2c179f..001c08f 100644 --- a/src/bin/game/cli.rs +++ b/src/bin/game/cli.rs @@ -71,11 +71,7 @@ fn main() -> anyhow::Result<()> { } } if response.won() { - println!( - "You win! You took {} guesses. {:?}", - game.step() - 1, - game.solution() - ); + println!("You win! You took {} guesses.", game.step() - 1); } else { println!("You lose! The solution was {:?}.", game.solution()); } @@ -88,9 +84,6 @@ fn get_word(_cli: &Cli, step: usize) -> std::io::Result { let stdin = std::io::stdin(); let mut stdout = std::io::stdout(); - // TODO: get user input - // TODO: validate user input - print!("guess {step} > "); stdout.flush()?; stdin.read_line(&mut word)?; diff --git a/src/game/mod.rs b/src/game/mod.rs index 4209df8..0094129 100644 --- a/src/game/mod.rs +++ b/src/game/mod.rs @@ -94,7 +94,7 @@ impl<'wl, WL: WordList> Game<'wl, WL> { for (idx, c) in guess.chars().enumerate() { if compare_solution.chars().nth(idx) == Some(c) { status = Status::Matched; - compare_solution.replace_range(idx..idx+1, "_"); + compare_solution.replace_range(idx..idx + 1, "_"); } else if compare_solution.contains(c) { status = Status::Exists; compare_solution = compare_solution.replacen(c, "_", 1);