From b78db00f9019014b48791b104d70848767c06b05 Mon Sep 17 00:00:00 2001 From: Luke Hubmayer-Werner Date: Fri, 4 Feb 2022 20:33:57 +1030 Subject: [PATCH] Charmask is not 8bit --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3e50d3c..f900ba0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -117,7 +117,7 @@ fn simulate(guess: &Word, solution: &Word, mut s: SimState, wordcache: &WordCach for (i, (gc, sc)) in guess.letters.iter().zip(solution.letters.iter()).enumerate() { let gb = char2bit(*gc); if gc == sc { // Right letter right position - s.banned_chars[i] = 255 ^ gb; + s.banned_chars[i] = !gb; } else if solution.charmask & gb != 0 { // Right letter wrong position s.banned_chars[i] |= gb; } else { // Letter not in solution @@ -144,7 +144,7 @@ fn find_worstcase(word: &Word, wordcache: &WordCache) -> (String, usize) { let mut worst_w = wordcache[&0][0].letters; let ss = SimState::default(); for target in &wordcache[&0] { - let remaining = simulate(word, target, ss, &wordcache).0; + let remaining = simulate(word, target, ss, wordcache).0; if remaining > worst { worst = remaining; worst_w = target.letters;