diff --git a/optimle/src/lib.rs b/optimle/src/lib.rs index 24df0bf..bcb9364 100644 --- a/optimle/src/lib.rs +++ b/optimle/src/lib.rs @@ -36,12 +36,6 @@ impl Puzzle { game.push(result); game_history.push(result); if game_history.len() > 2 { - if result.matches - .iter() - .filter(|&m| *m == LetterMatch::HERE) - .count() < 3 { - continue; - } let possible_words = game.guesser.get_possible_words(); let interesting_solutions = Puzzle::interesting(dictionary, &game_history, possible_words); if interesting_solutions.is_some() { @@ -67,6 +61,14 @@ impl Puzzle { return None; } + let heres = history.last().unwrap().matches + .iter() + .filter(|&m| *m == LetterMatch::HERE) + .count(); + if heres < 3 { + return None; + } + let base_constraints = &mut constraints::Total::new(); let constraints = &mut constraints::Total::new(); let mut evaluator = evaluator::AdversarialEvaluator::new(dictionary); @@ -92,8 +94,13 @@ impl Puzzle { } } + let max_solutions = match heres { + 4 => 20, + 3 => 100, + _ => panic!(), + }; let solution_count = solutions.len(); - let interesting = solution_count > 0 && solution_count <= 100; + let interesting = solution_count > 0 && solution_count <= max_solutions; if interesting { Some(solution_count) diff --git a/optimle/src/main.rs b/optimle/src/main.rs index aca6ef9..0202f2b 100644 --- a/optimle/src/main.rs +++ b/optimle/src/main.rs @@ -21,7 +21,7 @@ impl PuzzleOutput { fn main() { let common_words: Vec> = wordlelike::load::load_words(include_str!("../../wordlelike/src/words/common.txt")); - for seed in 0..=365 { + for seed in 11..=365 { let puzzle = Puzzle::generate(&common_words, seed); println!("{}", serde_json::to_string(&PuzzleOutput { history: puzzle.history