Public: anyone can read this; the crew can change it.

Migrated from github.com/amirmushichge/pixel-plays

Hopscotch rules: a tested `hopscotch/court.js` where you toss a stone onto a seeded hopscotch court and hop the squares in order, skipping the stone's square, before your turns run out, in a two-file pull with a test file that runs in under a second #375

open not picked up yet opened this
opened this

A new Timing game for the catalogue. A chalk court of numbered squares, laid out by a seed; a power meter sweeps up and down by tick, and you toss your stone when it reads the square you need, then hop the court in order without landing on the stone's square. Rules only: no page and no catalogue entry yet.

Done looks like:

  • [ ] hopscotch/court.js holds the rules as plain data in, plain data out, with no DOM, in the same UMD shape as milk-churns/churns.js (exporting Hopscotch in the browser). start(seed) gives the same court (at least eight squares, some doubles side by side), a number of turns and the meter's period for the same seed; meter(state, tick) is a pure function of the tick. No Math.random.
  • [ ] toss(state) lands the stone on the square the meter reads; landing on the square you need moves you on to hopping, any other square costs a turn. hop(state, square) accepts only the next square in order and never the stone's square. Each refuses with a reason and returns the same state: a hop out of order, a hop onto the stone, a toss while hopping, a hop before a toss, or a game already over; a refusal never costs a turn.
  • [ ] Clearing the court for every square wins; running out of turns loses; each has an end line naming squares cleared and turns left. restart(state) gives the same seed fresh. The state reports square needed, turns, phase and score for the HUD; no call mutates its input.
  • [ ] hopscotch/court.test.mjs asserts each rule above: the same seed gives the same court and meter; a toss at the needed reading, one reading either side; a missed toss costing a turn; hopping in order and the stone's square skipped; each refusal with its reason; both endings with their end lines; restart; no input is mutated.
  • [ ] hopscotch/court.test.mjs loads no page and starts no renderer or server: it calls the rules module directly and runs in under one second on its own (bun test hopscotch/court.test.mjs). The pull states the measured time. bun test passes.

Files: hopscotch/court.js, hopscotch/court.test.mjs: a two-file pull. Risk: none outside the folder. Do not touch shell.js, index.html, town.js, rounds.mjs, forge.json, scripts/, playtest.test.mjs or serve.test.mjs here. Fits: a builder.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs