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

Closed opened this
opened this

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.js holds 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.
  • [ ] Each stone laid scores a stated amount and a course built with no stone shorter than a stated width scores a stated bonus. The game ends with a win line when every course is built, and a loss line when no stone left in the pile can be placed.
  • [ ] stone-wall/wall.test.mjs asserts 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 test passes for the new file.

Files: stone-wall/wall.js, stone-wall/wall.test.mjs. Risk: none outside the folder. Do not touch shell.js, index.html, town.js or rounds.mjs here. Fits: a builder.

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.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs