From 83d1a907c12bc9c9dfd0cdad1be4e6a55a5a13c5 Mon Sep 17 00:00:00 2001 From: mike Date: Sun, 21 Dec 2025 22:07:58 +0100 Subject: [PATCH] update them --- src/puzzle/ThemePoolBuilderLength.java | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/puzzle/ThemePoolBuilderLength.java b/src/puzzle/ThemePoolBuilderLength.java index ba023b8..99d9b94 100644 --- a/src/puzzle/ThemePoolBuilderLength.java +++ b/src/puzzle/ThemePoolBuilderLength.java @@ -70,13 +70,13 @@ public class ThemePoolBuilderLength { // ---- NEW: enforce minimum counts per length in the final pool ---- // Tune these to your puzzle generator’s appetite for short words. - int minLen2 = 4000; - int minLen3 = 7000; - int minLen4 = 9000; - int minLen5 = 0; // set if you also want to force 5-letter words, etc. - int minLen6 = 0; - int minLen7 = 0; - int minLen8 = 0; + int minLen2 = 1000; + int minLen3 = 1000; + int minLen4 = 1000; + int minLen5 = 1000; // set if you also want to force 5-letter words, etc. + int minLen6 = 1000; + int minLen7 = 1000; + int minLen8 = 1000; } static Opts parseArgs(String[] args) { @@ -701,11 +701,17 @@ public class ThemePoolBuilderLength { } static void writeWordList(Path path, Lexicon lex, BitSet bs) throws IOException { - var out = new ArrayList(bs.cardinality()); + var ids = new ArrayList(bs.cardinality()); for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { - out.add(lex.words.get(i)); + ids.add(i); + } + // Sort by score descending (higher score is easier/better) + ids.sort((a, b) -> Integer.compare(lex.score[b], lex.score[a])); + + var out = new ArrayList(ids.size()); + for (var id : ids) { + out.add(lex.words.get(id)); } - out.sort(String::compareTo); Files.write(path, out, StandardCharsets.UTF_8, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); }