Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
Mill Race rules: a tested `mill-race/race.js` that turns pipe tiles to carry the stream to the water wheel, from plain data #174
Sign in to join this conversation.
A new Puzzle game for the catalogue: a mill stream enters one edge of a grid of channel tiles; turn the tiles until water runs unbroken from the sluice to the water wheel. Rules only: no page and no catalogue entry yet.
Done looks like:
mill-race/race.jsholds the rules as plain data in, plain data out, with no DOM.start(seed, level)lays out a stated grid of straight, bend, tee and blank tiles with a sluice on one edge and the wheel on another; the same seed and level always give the same grid, and every grid can be solved (build it by laying a connected path first, then turning each tile a seeded number of quarter turns).turn(state, x, y)rotates one tile a quarter turn clockwise and counts one move; a turn on a blank tile, or off the grid, is refused.flow(state)returns the cells the water reaches from the sluice; when it reaches the wheel the level is cleared and the next, larger level starts, up to a stated last level.mill-race/race.test.mjsasserts each rule above: the same seed giving the same grid, every generated level being solvable by undoing its turns, a refused turn, a quarter turn changing which neighbours connect,flowstopping at a break and reaching the wheel when joined, the level advancing, and the win and loss lines.bun testpasses for the new file.Files:
mill-race/race.js,mill-race/race.test.mjs. Risk: none outside the folder. Do not touchshell.js,index.html,town.jsorrounds.mjshere. Fits: a builder.