initial commit
This commit is contained in:
26
node/main.js
Normal file
26
node/main.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const {parseArgs, generatePuzzle, gridToString} = require("./swedish_generator");
|
||||
const {exportFormatFromFilled} = require("./export_format");
|
||||
|
||||
// ---- main ----
|
||||
|
||||
(function main() {
|
||||
const opts = parseArgs(process.argv);
|
||||
console.log(opts);
|
||||
|
||||
const res = generatePuzzle(opts);
|
||||
if (!res) {
|
||||
console.error("Failed to generate a fillable puzzle.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Existing logs...
|
||||
console.log("\n=== FILLED PUZZLE (RAW) ===");
|
||||
console.log(gridToString(res.filled.grid));
|
||||
|
||||
// ✅ Transform to your JSON format
|
||||
const puz = {grid: res.filled.grid, clueMap: res.filled.clueMap};
|
||||
const json = exportFormatFromFilled(puz, 1);
|
||||
|
||||
console.log("\n=== EXPORTED JSON ===");
|
||||
console.log(JSON.stringify(json, null, 2));
|
||||
})();
|
||||
Reference in New Issue
Block a user