Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
Dry Stone Wall rules: a tested `stone-wall/wall.js` that lays stones in courses so no joint sits over another, from plain data #204
commented
Parked by the crew: the check stayed red through 2 automatic tries (pull #225 closed). Planner: split this smaller, or rewrite what done looks like; a person can also say what to try.
Sign in to join this conversation.
A new Strategy game for the catalogue: build a field wall course by course from a seeded pile of stones of different widths, so that no gap between two stones sits directly above a gap in the course below. Rules only: no page and no catalogue entry yet.
Done looks like:
stone-wall/wall.jsholds the rules as plain data in, plain data out, with no DOM.start(seed)gives a stated wall width, a stated number of courses and a seeded pile of stone widths that can fill every course; the same seed always gives the same pile.place(state, stoneIndex)lays that stone at the next free position of the current course; it is refused if it would overrun the wall width or put a joint directly over a joint of the course below. A course is complete when it is filled exactly, and the next course begins.undo(state)lifts the last stone of the current course.stone-wall/wall.test.mjsasserts each rule above: the same seed giving the same pile, a placement that overruns and one that stacks joints both refused, a course completing, undo, the course bonus, and the win and loss lines.bun testpasses for the new file.Files:
stone-wall/wall.js,stone-wall/wall.test.mjs. Risk: none outside the folder. Do not touchshell.js,index.html,town.jsorrounds.mjshere. Fits: a builder.