Compare commits

..

1 commit

Author SHA1 Message Date
aac3e8804e 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 1m51s
2024-08-01 15:46:32 +02:00

View file

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