Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
Curling Rink rules: a tested `curling/rink.js` that slides stones down the ice with sweeping and collisions, from plain data #178
Sign in to join this conversation.
A new Sport game for the catalogue: slide eight stones down a sheet of ice toward the house, sweeping to carry them further, against a seeded set of guard stones already in play. Rules only: no page and no catalogue entry yet.
Done looks like:
curling/rink.jsholds the rules as plain data in, plain data out, with no DOM.start(seed)places a seeded set of opponent stones on a stated sheet, and the same seed always gives the same sheet.throw(state, { angle, power, curl })releases a stone; each value is clamped to a stated range and anything not a finite number is refused.tick(state, dt, sweeping)advances every moving stone with friction (lower whilesweepingis true), a sideways curl, and elastic collisions between stones; a stone past the back line or over a side line is removed.tickwith a fixeddtis deterministic.curling/rink.test.mjsasserts each rule above: the same seed giving the same sheet, a refused non-numeric throw, clamping, sweeping carrying a stone further than not sweeping, a collision moving the struck stone, a stone leaving over the back line, and the scoring for a known set of positions with the win and loss lines.bun testpasses for the new file.Files:
curling/rink.js,curling/rink.test.mjs. Risk: none outside the folder. Do not touchshell.js,index.html,town.jsorrounds.mjshere. Fits: a builder.