introduce bitloops

This commit is contained in:
mike
2026-01-14 07:25:46 +01:00
parent 5d34893ef1
commit c529ce90c7
7 changed files with 144 additions and 144 deletions

View File

@@ -1,7 +1,8 @@
package puzzle;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.val;
import lombok.NoArgsConstructor;
import puzzle.SwedishGenerator.Rng;
import java.io.IOException;
@@ -38,17 +39,18 @@ public class Main {
static final AtomicLong TOTAL_SIMPLICITY = new AtomicLong(0); // Scaled by 100 for precision
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class Opts {
public int seed = (int) (System.nanoTime() ^ System.currentTimeMillis());
public int pop = 18;
public int seed = (int) (System.nanoTime() ^ System.currentTimeMillis());
public int pop = 18;
public int gens = 1200;
public String wordsPath = "nl_score_hints_v3.csv";
public double minSimplicity = 0; // 0 means no limit
public int threads = Math.max(1, Runtime.getRuntime().availableProcessors());
public int tries = threads;
public boolean reindex = false;
public int fillTimeout = 20_000;
public boolean verbose = false;
}
@@ -356,9 +358,9 @@ public class Main {
}
static PuzzleResult _attempt(Rng rng, Dict dict, Opts opts) {
TOTAL_ATTEMPTS.incrementAndGet();
val stack = new int[STACK_SIZE];
var swe = new SwedishGenerator(rng, stack, Clues.createEmpty());
var swe = new SwedishGenerator(rng, new int[STACK_SIZE], Clues.createEmpty());
var mask = swe.generateMask(opts.pop, opts.gens, Math.max(opts.pop, (int) Math.floor(opts.pop * 1.5)));
var filled = fillMask(rng, extractSlots(mask), mask.toGrid(), dict.index());
TOTAL_NODES.addAndGet(filled.stats().nodes);
@@ -380,7 +382,7 @@ public class Main {
);
if (filled.ok() && (opts.minSimplicity <= 0 || filled.stats().simplicity >= opts.minSimplicity)) {
return new PuzzleResult(swe, dict, new Clued(mask), filled);
return new PuzzleResult(new Clued(mask), filled);
}
if (opts.verbose && filled.ok()) {