Compare commits

..

1 commit

Author SHA1 Message Date
714aac0d86 feat(naive): try to fix naive solver screwing up in less than 1% of cases WIP
Some checks failed
cargo devel CI / cargo CI (push) Failing after 1m50s
2024-08-01 17:25:36 +02:00

View file

@ -39,6 +39,10 @@ impl<'wl, WL: WordList> Solver<'wl, WL> for NaiveSolver<'wl, WL> {
match p.1 {
Status::Matched => {
pattern.replace_range(idx..idx + 1, &p.0.to_string());
other_chars.entry(p.0).or_default();
let v = other_chars.get_mut(&p.0).unwrap();
v.1 += 1;
}
Status::Exists => {
other_chars.entry(p.0).or_default();
@ -46,8 +50,7 @@ impl<'wl, WL: WordList> Solver<'wl, WL> for NaiveSolver<'wl, WL> {
v.0.push(idx);
// TODO: count how many times the char occurs
v.1 =
v.1.min(evaluation.guess().chars().filter(|c| *c == p.0).count());
v.1 += 1;
}
Status::None => {
other_chars.entry(p.0).or_default();