generated from PlexSheep/rs-base
improve naive solver #13
|
@ -131,14 +131,6 @@ impl<'wl, WL: WordList> Game<'wl, WL> {
|
||||||
let mut status: Status;
|
let mut status: Status;
|
||||||
let mut buf: Vec<char> = solution.chars().collect();
|
let mut buf: Vec<char> = solution.chars().collect();
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
let buflen = solution.len();
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
{
|
|
||||||
assert_eq!(buflen, buf.len());
|
|
||||||
assert_eq!(buflen, evaluation.len());
|
|
||||||
}
|
|
||||||
|
|
||||||
// first the correct solutions
|
// first the correct solutions
|
||||||
for ((idx, c_guess), c_sol) in guess.chars().enumerate().zip(solution.chars()) {
|
for ((idx, c_guess), c_sol) in guess.chars().enumerate().zip(solution.chars()) {
|
||||||
if c_guess == c_sol {
|
if c_guess == c_sol {
|
||||||
|
@ -148,12 +140,6 @@ impl<'wl, WL: WordList> Game<'wl, WL> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
{
|
|
||||||
assert_eq!(buflen, buf.len());
|
|
||||||
assert_eq!(buflen, evaluation.len());
|
|
||||||
}
|
|
||||||
|
|
||||||
// then check if the char exists, but was not guessed to be at the correct position
|
// then check if the char exists, but was not guessed to be at the correct position
|
||||||
//
|
//
|
||||||
// We split this up, because finding the "exists" chars at the same time as the "correct"
|
// We split this up, because finding the "exists" chars at the same time as the "correct"
|
||||||
|
@ -175,12 +161,6 @@ impl<'wl, WL: WordList> Game<'wl, WL> {
|
||||||
}
|
}
|
||||||
evaluation[idx] = (c_guess, status);
|
evaluation[idx] = (c_guess, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
{
|
|
||||||
assert_eq!(buflen, buf.len());
|
|
||||||
assert_eq!(buflen, evaluation.len());
|
|
||||||
}
|
|
||||||
evaluation.into()
|
evaluation.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue