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

Migrated from github.com/amirmushichge/pixel-plays

Welly Toss rules: a tested `welly-toss/throw.js` where you swing a boot and let go at the right moment of the arc to land it past the marker flags, against a seeded crosswind, from plain data, in a two-file pull with a test file that runs in under a second #309

shipped production is serving it opened this has it
opened this

A new Throwing game for the catalogue. You swing a rubber boot back and forth on a pendulum of stated period; releasing sets its angle and speed from the swing phase, and a seeded crosswind per throw drifts it. A boot that lands outside the side lines is a foul. Five throws; the best three distances count. Rules only: no page and no catalogue entry yet.

Done looks like:

  • [x] welly-toss/throw.js holds the rules as plain data in, plain data out, with no DOM. start(seed) gives five throws each with a seeded crosswind within a stated range, the side lines, and the marker flags at stated distances. Randomness comes only from the seed, so the same seed and inputs give the same contest; no timers and no Math.random.
  • [x] step(state) advances the swing one tick. release(state) lets go and resolves the flight from the swing phase and the wind to a landing point, a distance and the flag it passed, or a foul when it lands outside the side lines. It refuses a release during a flight or after the fifth throw, with a reason and the same state. Releasing at the stated best phase in still air lands furthest; releasing on the backswing is a foul.
  • [x] The contest ends after five throws. The score is the sum of the best three non-foul distances, and the end line reports it with the furthest flag reached.
  • [x] welly-toss/throw.test.mjs asserts each rule above: the same seed giving the same winds and the same contest, the best-phase release beating an early and a late one, the wind drifting a throw, a side-line foul, a backswing foul, each refusal and its reason, the best-three sum with fouls among the throws, and the end line.
  • [x] bun test passes for the new file.
  • [x] welly-toss/throw.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 welly-toss/throw.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: welly-toss/throw.js, welly-toss/throw.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 #323 at its head: ticked welly-toss/throw.js holds the rules as plain data in, plain data out, with no DOM. start(seed) gives five throws each with a seeded crosswind within a stated range, the side lines, and the marker flags at stated distances. Randomness comes only from the seed, so the same seed and inputs give the same contest; no timers and no Math.random.; step(state) advances the swing one tick. release(state) lets go and resolves the flight from the swing phase and the wind to a landing point, a distance and the flag it passed, or a foul when it lands outside the side lines. It refuses a release during a flight or after the fifth throw, with a reason and the same state. Releasing at the stated best phase in still air lands furthest; releasing on the backswing is a foul.; The contest ends after five throws. The score is the sum of the best three non-foul distances, and the end line reports it with the furthest flag reached.; welly-toss/throw.test.mjs asserts each rule above: the same seed giving the same winds and the same contest, the best-phase release beating an early and a late one, the wind drifting a throw, a side-line foul, a backswing foul, each refusal and its reason, the best-three sum with fouls among the throws, and the end line.; bun test passes for the new file.; welly-toss/throw.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 welly-toss/throw.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