introduce bitloops
This commit is contained in:
@@ -125,6 +125,7 @@ public class Main {
|
||||
else rebuildIndex();
|
||||
info("indexUpdated : " + INDEX_FILE);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
err("Failed to write: " + FILE_NAME);
|
||||
err("Reason : " + e.getMessage());
|
||||
System.exit(2);
|
||||
@@ -344,6 +345,15 @@ public class Main {
|
||||
}
|
||||
|
||||
static PuzzleResult attempt(Rng rng, Dict dict, Opts opts) {
|
||||
try {
|
||||
return _attempt(rng, dict, opts);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.err.println("Failed to operate" + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
static PuzzleResult _attempt(Rng rng, Dict dict, Opts opts) {
|
||||
TOTAL_ATTEMPTS.incrementAndGet();
|
||||
var swe = new SwedishGenerator(rng);
|
||||
var mask = swe.generateMask(opts.pop, opts.gens, Math.max(opts.pop, (int) Math.floor(opts.pop * 1.5)));
|
||||
@@ -422,6 +432,7 @@ public class Main {
|
||||
Files.writeString(indexPath, content, StandardCharsets.UTF_8);
|
||||
info("indexUpdated : " + indexPath);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
err("Failed to update index.json: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -462,10 +473,12 @@ public class Main {
|
||||
var pathInIndex = "/puzzles/" + filename;
|
||||
records.add(toIndexRecordJson(id, pathInIndex, date, theme, difficulty, createdAt));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
err("Failed to read " + path + ": " + e.getMessage());
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
err("Failed to list puzzles: " + e.getMessage());
|
||||
return;
|
||||
}
|
||||
@@ -476,6 +489,7 @@ public class Main {
|
||||
Files.writeString(indexPath, content, StandardCharsets.UTF_8);
|
||||
info("Successfully rebuilt index.json with " + records.size() + " records.");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
err("Failed to write index.json: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user