Gather data

This commit is contained in:
mike
2026-01-08 00:37:54 +01:00
parent efe70fb121
commit 2680e70418
6 changed files with 105 additions and 133 deletions

View File

@@ -32,6 +32,7 @@ public class Main {
@Data
public static class Opts {
public int seed = (int) (System.nanoTime() ^ System.currentTimeMillis());
public int pop = 18;
public int gens = 500;
@@ -42,8 +43,6 @@ public class Main {
public boolean reindex = false;
public int fillTimeout = 20_000;
public boolean verbose = false;
public int W = 9;
public int H = 8;
}
public void main(String[] args) {
@@ -159,7 +158,7 @@ public class Main {
safe(w.direction(), 3),
fmtPoint(w.startRow(), w.startCol()),
fmtPoint(w.arrowRow(), w.arrowCol()),
Arrays.toString(w.lemma().clue().toArray(String[]::new)));
Arrays.toString(w.lemma().clue().toArray(String[]::new)));
}
}
@@ -312,7 +311,7 @@ public class Main {
}
static PuzzleResult attempt(Rng rng, Dict dict, Opts opts) {
var swe = new SwedishGenerator(opts.W, opts.H);
var swe = new SwedishGenerator();
var mask = swe.generateMask(rng, dict.lenCounts(), opts.pop, opts.gens, opts.verbose);
var filled = swe.fillMask(rng, mask, dict.index(), 200, opts.fillTimeout, opts.verbose);
@@ -352,7 +351,7 @@ public class Main {
sb.append(" \"words\": [\n");
for (var i = 0; i < puzzle.words().length; i++) {
var w = puzzle.words()[i];
var clues = w. clue().toArray(String[]::new);
var clues = w.clue().toArray(String[]::new);
Arrays.sort(clues, Comparator.comparingInt(String::length));
sb.append(" {\n");
sb.append(" \"word\": \"").append(escapeJson(w.word())).append("\",\n");