Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
Lock Keeper rules: a tested `lock-keeper/lock.js` that works boats through a flight of canal locks from plain data #140
Sign in to join this conversation.
A new Strategy game for the catalogue: open sluices and gates on a flight of three canal locks to bring every waiting narrowboat through, up or down, in as few operations as you can. Rules only: no page and no catalogue entry yet.
Done looks like:
lock-keeper/lock.jsholds the rules as plain data in, plain data out, with no DOM. Each lock has a water level (low or high), a top gate, a bottom gate and a paddle on each. Operations are plain data ({ lock, act: 'paddle-top' | 'paddle-bottom' | 'gate-top' | 'gate-bottom' | 'move' }). A gate opens only when the water both sides is level; a refused operation leaves the state unchanged and says why. Opening both paddles of one lock at once floods the lock and ends the round as a loss.lock-keeper/lock.test.mjsasserts each rule above: a refused gate on uneven water, a paddle filling and emptying, a boat moving only through an open gate, the flood loss, the win when all boats are through, the same seed giving the same queue, and that par is reachable for the shipped seeds.bun testpasses for the new file.Files:
lock-keeper/lock.js,lock-keeper/lock.test.mjs. Risk: none outside the folder. Do not touchshell.js,index.htmlorrounds.mjshere. Fits: a builder.