diff --git a/60_Mastermind/README.md b/60_Mastermind/README.md index 2e74ed1c..7820eed7 100644 --- a/60_Mastermind/README.md +++ b/60_Mastermind/README.md @@ -28,7 +28,7 @@ As published in Basic Computer Games (1978): Downloaded from Vintage Basic at http://www.vintage-basic.net/games.html -###How the computer deduces your guess. +### How the computer deduces your guess. The computer takes the number of black pegs and white pegs that the user reports and uses that information as a target. It then assumes its guess is the answer diff --git a/60_Mastermind/rust/src/main.rs b/60_Mastermind/rust/src/main.rs index afe1802d..2c31f4c0 100644 --- a/60_Mastermind/rust/src/main.rs +++ b/60_Mastermind/rust/src/main.rs @@ -324,7 +324,7 @@ fn main() { all_possibilities.iter_mut().enumerate().for_each(|b| { if *b.1 { //filter out ones we already know aren't possible let mut tmp_guess = GUESS::new(CODE::new_from_int(b.0, num_colors, num_positions)); - tmp_guess.evaluate(&answer); + tmp_guess.evaluate(&guess.code); //compare with computer guess if blacks != tmp_guess.blacks || whites != tmp_guess.whites { //if number of blacks/whites is different, set it to false *b.1 = false; }