One engine, twenty games
engine.js is the same file in all twenty — not similar, byte-for-byte
identical, which is checked with md5sum rather than claimed. It handles the fixed-timestep loop, the
entity list, layered drawing and input, and it knows nothing about running, matching,
shooting, bouncing, wrapping, marching, stacking, chasing, driving, putting, landing or
pedalling — which is the only reason eighteen more games could pick it up.
Each puzzle game keeps its rules in a file that touches no pixels at all —
board.js, hexgrid.js, bricks.js,
torus.js, invaders.js, blocks.js, td.js,
moles.js, road.js, maze.js, sokoban.js
— so the awkward part of each is unit tested rather than eyeballed: are there any
legal moves left, what does a ball moving faster than a brick is thick actually
hit, how far apart are two balls on a field with no edges, how fast does a
swarm move when nothing tells it a speed, do a row and a column clear together,
does a creep cover the same ground on a short leg as a long one, and
can this level be solved at all, can this board be cleared without guessing,
can this piece turn against a wall, could the player have dodged that, and
can the ball ever escape the course. 1,145 assertions across twenty
suites. Most were wrong at first, and every one of those was caught here rather than
by a player — including two castle floor plans that could not be finished, a Sokoban
level with no solution, and a bullet pattern with no way out.
The student Nanonauts builds these grew out of are archived separately, at
proto.stroetenga.nl/Nanonauts.
That link is absolute on purpose: this page is served from two different sites, and a
relative one only resolves on the one it was written for.