Skip to content

Commit

Permalink
Invalid guess should not count as an attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
muan committed Jun 29, 2020
1 parent b29b2ea commit d66e9ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Expand Up @@ -25,8 +25,7 @@ For example, with an answer of 7130, a guess of 3610 will receive 1A2B.
// println!("-----------------------------------------------------------------------");

loop {
tries = tries + 1;
println!("> ({}) Enter a 4-digit number:", tries);
println!("> ({}) Guess a 4-digit number:", tries);
let mut guess = String::new();

io::stdin()
Expand Down Expand Up @@ -56,6 +55,7 @@ For example, with an answer of 7130, a guess of 3610 will receive 1A2B.
continue;
},
Ordering::Equal => {
tries = tries + 1;
let result = check_answer(&answer, &guess);
if result == "4A0B" {
println!("You got it! 👾");
Expand Down

0 comments on commit d66e9ea

Please sign in to comment.