mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-26 12:51:29 -08:00
Rust: update comparison logic to follow README.md
will likely refactor this project later
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user