Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
Rope Swing rules: a tested `rope-swing/river.js` where you let go of a seeded swinging rope at the right moment to land on the far bank across a widening river, in a two-file pull with a test file that runs in under a second #364
Sign in to join this conversation.
A new Timing game for the catalogue. A rope hangs from an oak over the village river; it swings on a seeded rhythm and you let go so you land on the far bank, and each crossing the river is wider and the landing shorter. Rules only: no page and no catalogue entry yet.
Done looks like:
rope-swing/river.jsholds the rules as plain data in, plain data out, with no DOM, in the same UMD shape asapple-bobbing/tub.js(exportingRopeSwingin the browser).start(seed)gives crossing one: the swing's period and phase, the river's width and the landing window, from the seed only, so the same seed gives the same crossings; no Math.random. A non-numeric seed falls back to 0.step(state)advances the swing one tick;swing(state, tick)(exported) gives the rope's angle at a tick.release(state)lets go: the landing distance follows from the angle at that tick, and a landing inside the window scores more the nearer its centre. Each call refuses with a reason and returns the same state while you are in the air, or once the game is over.rope-swing/river.test.mjsasserts each rule above: same seed same crossings; a release at the best tick lands at the window's centre, one at the window's edge lands for the smaller score and one just outside splashes; a splash costs a life; each refusal with its reason; each crossing is wider and narrower; the loss line and the win line.rope-swing/river.test.mjsloads 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 rope-swing/river.test.mjs). The pull states the measured time.bun testpasses.Files:
rope-swing/river.js,rope-swing/river.test.mjs: a two-file pull. Risk: none outside the folder. Do not touchshell.js,index.html,town.js,rounds.mjs,forge.json,scripts/,playtest.test.mjsorserve.test.mjshere. Fits: a builder.