Rust: update comparison logic to follow README.md

will likely refactor this project later
This commit is contained in:
AnthonyMichaelTDM
2022-04-29 11:18:17 -07:00
parent 806ce22d53
commit f745dad4b2
2 changed files with 2 additions and 2 deletions

View File

@@ -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

View File

@@ -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;
}