import fs from 'node:fs' // Fixture regeneration aid (see scripts/fixtures/README.md). Written during the 2026-11-11 build, kept for reference. // Writes into fixtures/ unless FIXTURES_OUT names another directory (with a trailing slash). const FIX = process.env.FIXTURES_OUT ?? new URL('../../fixtures/', import.meta.url).pathname const SOL = new URL('../../js/solutions/', import.meta.url).href const HERE = new URL('./', import.meta.url).pathname const { violations } = await import(SOL + 'check.js') const f = FIX + 'm12-violations.json' const fx = JSON.parse(fs.readFileSync(f, 'utf8')) const sane = fx.cases.find((c) => c.name === 'a-pending-perpendicular-turn-is-fine').args[0] console.log(JSON.stringify(sane)) const mk = (name, patch) => { const s = { ...sane, ...patch }; return { name, args: [s], expected: violations(s) } } const cases = [ mk('a-queued-turn-is-fine', { dir: 'Right', nextDir: 'Up', queued: 'Left' }), mk('queued-turn-straight-back-from-the-pending-turn', { dir: 'Right', nextDir: 'Up', queued: 'Down' }), mk('reversed-pending-turn-and-reversed-queue-are-both-listed', { dir: 'Right', nextDir: 'Left', queued: 'Right' }), ] cases.forEach((c) => console.log(c.name, JSON.stringify(c.expected))) const names = new Set(cases.map((c) => c.name)) fs.writeFileSync(f, JSON.stringify({ ...fx, cases: [...fx.cases.filter((c) => !names.has(c.name)), ...cases] }, null, 2) + '\n')