chore(js): polish pong keys, held mapping and m09 main test

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
Lucas Winther
2026-10-29 00:02:23 +01:00
co-authored by Claude Sonnet 5.5
parent 3146bb630a
commit 59bece5443
10 changed files with 209 additions and 16 deletions
+2 -2
View File
@@ -6,8 +6,8 @@ export const FRAME_MS_PONG = 30
/**
* Translate a key event into a `PongAction`, or `null`. `isDown` is true for a key press, false for a release.
* `ArrowUp`/`w` -> `Press('Up')` / `Release('Up')`, `ArrowDown`/`s` -> `Press('Down')` / `Release('Down')`,
* `r` -> `Restart` (on press only; releasing `r` does nothing). Any other key -> `null`.
* `ArrowUp`/`w`/`W` -> `Press('Up')` / `Release('Up')`, `ArrowDown`/`s`/`S` -> `Press('Down')` / `Release('Down')`,
* `r`/`R` -> `Restart` (on press only; releasing `r` does nothing). Any other key -> `null`.
*/
export const pongKey = (isDown, key) => todo('m11')
+1 -1
View File
@@ -6,7 +6,7 @@ export const clamp = (lo, hi, x) => todo('m11')
/**
* The one function that says how a match changes: `(state, action) -> state`.
*
* - `Press(key)` / `Release(key)`: set `held.up` or `held.down` (even when the match is over).
* - `Press(key)` / `Release(key)`: set `held.up` or `held.down` (even when the match is over); any other key leaves the state unchanged.
* - `Restart`: `initialPong(state.seed)`.
* - `Frame`: unchanged unless status is 'Playing'. Otherwise, in this order:
* 1. `frame + 1`.