#!/usr/bin/env node // Headless solver harness for the 1MB roguelike. // Usage: node tools/validate.js [seedCount] [gameDir] // // Loads the real, unmodified game: evaluates 1mb/data.js and the inline // engine script from 1mb/index.html inside a stubbed browser environment, // then sweeps seedCount seeds x floors 1-7 asserting floorSolve() proves // each full floor completable (gate -> torch -> bow -> vault -> escape // room -> gate) — the same check the in-game validateSeeds() runs. "use strict" const fs = require("fs") const path = require("path") const vm = require("vm") const seedCount = Math.max(1, parseInt(process.argv[2], 10) || 200) const gameDir = process.argv[3] || path.join(__dirname, "..", "1mb") const html = fs.readFileSync(path.join(gameDir, "index.html"), "utf8") const dataSrc = fs.readFileSync(path.join(gameDir, "data.js"), "utf8") // The engine is the inline