clone

a browser grid puzzle game where you push words around to rewrite the rules of each level

Align Word Lab lesson with PUSH precedence

Dami committed 0d99df6
commit
0d99df69ecb44bbd2074364c2d803ce864759375
parent
69851e2326f7a91642966f727f4ffeb374cba831
author
Dami <dami.etoile@gmail.com>
2 files changed, +23 -5
Mmods/word-lab.cjs10++++++----
Mtests/word-lab.test.js18+++++++++++++++++-
M mods/word-lab.cjs +6 -4
M tests/word-lab.test.js +17 -1
@@ -3,6 +3,7 @@ import assert from 'node:assert/strict';
33 import { readFile } from 'node:fs/promises';44 import { createGame } from '../src/engine.js';55 import { loadMod } from '../src/mods.js';6+import { checkLevel } from '../src/solver/check-level.js';67 78 const source = await readFile(new URL('../mods/word-lab.cjs', import.meta.url), 'utf8');89 const pack = loadMod(source, { filename: 'word-lab.cjs' });
@@ -20,6 +21,11 @@ test('Word Lab has a stable identity and three authored levels', () => {
2021 'rules-are-cargo',2122 ]);2223 assert.equal(pack.palette.GEM, '💎');24+ const cargo = pack.levels[2];25+ assert.equal(cargo.title, 'Push beats stop');26+ assert.equal(cargo.hint, 'ROCK is STOP and PUSH at once. Which one wins when you walk into it?');27+ assert.equal(cargo.allowBypass, true);28+ assert.equal(cargo.allowHandsOff, true);2329 });2430 2531 test('shared control uses AND to let ROCK solve the level while MIAU is stopped', () => {
@@ -51,7 +57,7 @@ test('noun transformation changes ROCK into the controllable GEM', () => {
5157 assert.equal(game.getState().won, true);5258 });5359 54-test('PUSH takes precedence over STOP in Rules are cargo', () => {60+test('PUSH beats STOP in the authored cargo proof', () => {5561 const game = createGame(pack.levels[2]);5662 assert.equal(game.has('ROCK', 'PUSH'), true);5763 assert.equal(game.has('ROCK', 'STOP'), true);
@@ -61,6 +67,16 @@ test('PUSH takes precedence over STOP in Rules are cargo', () => {
6167 assert.equal(game.has('ROCK', 'STOP'), true);6268 });6369 70+test('cargo proof imports cleanly and classifies its allowed routes', () => {71+ const result = checkLevel(pack.levels[2], { cap: 100_000 });72+ assert.equal(result.ok, true);73+ assert.equal(result.issues.length, 0);74+ assert.deepEqual(result.warnings, []);75+ assert.equal(result.checks.result.status, 'SOLVED');76+ assert.equal(result.checks.bypass.status, 'SOLVED');77+ assert.equal(result.checks.handsOff.status, 'SOLVED');78+});79+6480 test('editing a stacked predicate removes STOP while preserving PUSH', () => {6581 const game = createGame(pack.levels[2]);6682 move(game, 'right', 4);