Gather data

This commit is contained in:
mike
2026-01-04 03:50:34 +01:00
parent 6bf83aa564
commit f031591105
5 changed files with 21 additions and 77 deletions

View File

@@ -11,6 +11,7 @@ import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.*;
import java.util.stream.Collectors;
import static puzzle.SwedishGenerator.fillMask;
import static puzzle.SwedishGenerator.generateMask;
@@ -83,7 +84,6 @@ public class Main {
section("Clues");
info("status : generating...");
info("generatedFor : " + exported.words().size());
//exported = ClueGenerator.applyClues(exported);
info("status : done");
section("Words");
@@ -92,10 +92,7 @@ public class Main {
section("Gridv2");
for (var row : exported.gridv2()) System.out.println(" " + row);
// Export to JSON file
var theme = "algemeen";
section("Export");
info("file : " + OUTPUT_PATH);
@@ -151,14 +148,14 @@ public class Main {
for (var w : words) {
System.out.printf(
Locale.ROOT,
" %-2d %-12s %-3s %-3s %-9s %-9s %s%n",
" %-2d %-12s %-4s %-3s %-9s %-9s %s%n",
i++,
safe(w.word(), 12),
safe("" + w.complex(), 3),
safe("" + w.complex(), 4),
safe(w.direction(), 3),
fmtPoint(w.startRow(), w.startCol()),
fmtPoint(w.arrowRow(), w.arrowCol()),
w.clue() == null ? "" : w.clue()
w.clue() == null ? "" : Arrays.toString(w.clue())
);
}
}
@@ -332,9 +329,10 @@ public class Main {
sb.append(" \"words\": [\n");
for (var i = 0; i < puzzle.words().size(); i++) {
var w = puzzle.words().get(i);
Arrays.sort(w.clue(), Comparator.comparingInt(String::length));
sb.append(" {\n");
sb.append(" \"word\": \"").append(escapeJson(w.word())).append("\",\n");
sb.append(" \"clue\": \"").append(escapeJson(w.clue())).append("\",\n");
sb.append(" \"clue\": [").append(Arrays.stream(w.clue()).map(ss -> "\"" + escapeJson(ss) + "\"").collect(Collectors.joining(","))).append("],\n");
sb.append(" \"startRow\": ").append(w.startRow()).append(",\n");
sb.append(" \"startCol\": ").append(w.startCol()).append(",\n");
sb.append(" \"direction\": \"").append(escapeJson(w.direction())).append("\",\n");