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

Migrated from github.com/amirmushichge/pixel-plays

Skipping Rope rules: a tested `skipping-rope/rope.js` where you jump the turning rope as it quickens and more skippers join, from plain data, in a two-file pull with a test file that runs in under a second #270

shipped production is serving it opened this has it
opened this

A new Timing game for the catalogue: two friends turn a long skipping rope and you jump each time it reaches the ground, while the turning quickens and more skippers join the line. Rules only: no page and no catalogue entry yet.

Done looks like:

  • [x] skipping-rope/rope.js holds the rules as plain data in, plain data out, with no DOM, no timers and no Math.random. start() gives a rope turning at a stated starting period, with the rope's angle a function of time so that where it is does not depend on how time is sliced.
  • [x] tick(state, dt) advances the rope; dt must be a finite number above 0. jump(state) lifts the skipper for a stated airtime and is refused while already in the air. When the rope passes the ground, a skipper in the air clears it and scores a stated amount; a skipper on the ground is caught, and the game ends with a loss line reporting skips and score.
  • [x] Every stated number of clears, the period shortens by a stated step down to a stated floor, and another skipper joins, up to a stated number: each skipper adds a stated amount to the score of every later clear. Reaching a stated total of clears ends the game with a win line.
  • [x] skipping-rope/rope.test.mjs asserts each rule above: the same jumps at the same times clear the same skips however time is sliced, a jump in the air refused, a clear, a catch with the loss line, the quickening and its floor, skippers joining and raising the score, and the win line.
  • [x] bun test passes for the new file.
  • [x] skipping-rope/rope.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 skipping-rope/rope.test.mjs). The pull states the measured time.
  • [x] If the check fails only on "test took longer than 600s" or a CPU limit, the pull says so. Do not cut the rules or their tests to get under the limit.

Files: skipping-rope/rope.js, skipping-rope/rope.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.

commented

Reviewed pull #291 at its head: ticked skipping-rope/rope.js holds the rules as plain data in, plain data out, with no DOM, no timers and no Math.random. start() gives a rope turning at a stated starting period, with the rope's angle a function of time so that where it is does not depend on how time is sliced.; tick(state, dt) advances the rope; dt must be a finite number above 0. jump(state) lifts the skipper for a stated airtime and is refused while already in the air. When the rope passes the ground, a skipper in the air clears it and scores a stated amount; a skipper on the ground is caught, and the game ends with a loss line reporting skips and score.; Every stated number of clears, the period shortens by a stated step down to a stated floor, and another skipper joins, up to a stated number: each skipper adds a stated amount to the score of every later clear. Reaching a stated total of clears ends the game with a win line.; skipping-rope/rope.test.mjs asserts each rule above: the same jumps at the same times clear the same skips however time is sliced, a jump in the air refused, a clear, a catch with the loss line, the quickening and its floor, skippers joining and raising the score, and the win line.; bun test passes for the new file.; skipping-rope/rope.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 skipping-rope/rope.test.mjs). The pull states the measured time.; If the check fails only on "test took longer than 600s" or a CPU limit, the pull says so. Do not cut the rules or their tests to get under the limit..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs