clone

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

docs(content): use proof names in the basics pack

Dami committed 1545030
commit
15450306a61927847a179066d6cab91625d586d2
parent
3f76a68a113c8450e34d5a5bbd671102f9fdf4b6
author
Dami <dami.etoile@gmail.com>
2 files changed, +15 -13
Mmods/garden-basics.cjs4++--
Mtests/garden-basics.test.js24+++++++++++++-----------
M mods/garden-basics.cjs +2 -2
M tests/garden-basics.test.js +13 -11
@@ -5,22 +5,24 @@ import { createGame } from '../src/engine.js';
55 import { loadMod } from '../src/mods.js';66 77 const source = await readFile(new URL('../mods/garden-basics.cjs', import.meta.url), 'utf8');8-const garden = loadMod(source, { filename: 'garden-basics.cjs' });8+const basicProofs = loadMod(source, { filename: 'garden-basics.cjs' });99 1010 const move = (game, direction, count = 1) => {1111 const delta = { up: [0, -1], down: [0, 1], left: [-1, 0], right: [1, 0] }[direction];1212 for (let index = 0; index < count; index++) game.step(...delta);1313 };1414 15-test('garden basics has stable metadata and one active campaign pack', () => {16- assert.equal(garden.manifest.id, 'garden-basics');17- assert.deepEqual(garden.levels.map(level => level.id), ['garden-push', 'garden-pond', 'garden-thorns']);18- assert.equal(new Set(garden.levels.map(level => level.id)).size, garden.levels.length);19- assert.deepEqual(garden.vocabulary, ['MIAU', 'ROCK', 'FLAG', 'WATER', 'THORN']);15+test('Basic Proofs keeps its stable internal pack and level IDs', () => {16+ assert.equal(basicProofs.manifest.name, 'Basic Proofs');17+ assert.equal(basicProofs.manifest.id, 'garden-basics');18+ assert.equal(basicProofs.levels[0].title, 'Clear the Path');19+ assert.deepEqual(basicProofs.levels.map(level => level.id), ['garden-push', 'garden-pond', 'garden-thorns']);20+ assert.equal(new Set(basicProofs.levels.map(level => level.id)).size, basicProofs.levels.length);21+ assert.deepEqual(basicProofs.vocabulary, ['MIAU', 'ROCK', 'FLAG', 'WATER', 'THORN']);2022 });2123 2224 test('garden-push requires the PUSH rule to clear ROCK', () => {23- const game = createGame(garden.levels[0]);25+ const game = createGame(basicProofs.levels[0]);2426 assert.equal(game.has('ROCK', 'PUSH'), true);2527 move(game, 'right');2628 move(game, 'down');
@@ -33,12 +35,12 @@ test('garden-push requires the PUSH rule to clear ROCK', () => {
3335 });3436 3537 test('garden-pond exposes SINK and still has a safe winning route', () => {36- const hazard = createGame(garden.levels[1]);38+ const hazard = createGame(basicProofs.levels[1]);3739 assert.equal(hazard.has('WATER', 'SINK'), true);3840 move(hazard, 'right', 3);3941 assert.equal(hazard.getState().objects.some(object => object.id === 'garden-pond-miau'), false);4042 41- const game = createGame(garden.levels[1]);43+ const game = createGame(basicProofs.levels[1]);4244 move(game, 'right', 2);4345 move(game, 'up', 2);4446 move(game, 'right', 4);
@@ -47,12 +49,12 @@ test('garden-pond exposes SINK and still has a safe winning route', () => {
4749 });4850 4951 test('garden-thorns exposes DEFEAT and still has a safe winning route', () => {50- const hazard = createGame(garden.levels[2]);52+ const hazard = createGame(basicProofs.levels[2]);5153 assert.equal(hazard.has('THORN', 'DEFEAT'), true);5254 move(hazard, 'right', 3);5355 assert.equal(hazard.getState().objects.some(object => object.id === 'garden-thorn-miau'), false);5456 55- const game = createGame(garden.levels[2]);57+ const game = createGame(basicProofs.levels[2]);5658 move(game, 'right', 2);5759 move(game, 'up', 2);5860 move(game, 'right', 4);