diff --git a/docs/superpowers/plans/2026-10-28-pure-snake-course.md b/docs/superpowers/plans/2026-10-28-pure-snake-course.md index cb7ca77..37defe5 100644 --- a/docs/superpowers/plans/2026-10-28-pure-snake-course.md +++ b/docs/superpowers/plans/2026-10-28-pure-snake-course.md @@ -125,7 +125,7 @@ JS shapes shown; Scala = case classes / enums with the same field names; F# = re **m11 pong (capstone):** W=80, H=50, `PCELL=8`, `PADDLE=8`, `PLAYER_X=2`, `CPU_X=77`, `WIN=5`. - `PongState {ball:{x,y}, vel:{dx,dy}, player, cpu, held:{up,down}, score:{player,cpu}, status:'Playing'|'Over', seed, frame}`; `initialPong(seed)`: ball (40,25), vel (1,1), player 21, cpu 21, held false/false, score 0/0, Playing, frame 0. -- `PongAction = {tag:'Press', key:'Up'|'Down'} | {tag:'Release', key} | {tag:'Frame'} | {tag:'Restart'}`; `pongKey(isDown, key)`: ArrowUp/w → Up, ArrowDown/s → Down, r (down only) → Restart. +- `PongAction = {tag:'Press', key:'Up'|'Down'} | {tag:'Release', key} | {tag:'Frame'} | {tag:'Restart'}`; `pongKey(isDown, key)`: ArrowUp/w/W → Up, ArrowDown/s/S → Down, r/R (down only) → Restart. - `pongUpdate(s, a)`: Press/Release set `held`; Restart → `initialPong(s.seed)`; Frame (only when Playing): `frame+1`; player += (down?1:0)-(up?1:0) clamped to [0, H-PADDLE]; on even new frame cpu moves 1 toward `ball.y - PADDLE/2`, clamped; ball: `ny = y+dy`; if `ny<0 || ny>=H` then `dy=-dy`, `ny=y+dy`; `nx = x+dx`; if `nx==PLAYER_X && dx<0 && player≤ny0 && cpu≤ny=W` player scores; scoring → serve: ball (40,25), `dx` toward the side that conceded (cpu scored → -1, player scored → +1), `dy = (nextUint32 % 2 == 0) ? 1 : -1` advancing seed; reaching WIN → status Over. - `pongView(s)`: bg `Rect(0,0,640,400,'#111111')`, paddles `Rect(X*8, y*8, 8, 64, '#ffffff')` player then cpu, ball `Rect(x*8, y*8, 8, 8, '#ffeb3b')`, `Text(320, 30, '

', '#ffffff', 24, 'center')`, Over → `Text(320, 200, p>c ? 'You Win!' : 'CPU Wins', '#ffffff', 32, 'center')` + `Text(320, 230, 'Press R to restart', '#ffffff', 16, 'center')`. - `pongMain` like `main`, using `interval(30)` → Frame, `keyDowns`/`keyUps` → `pongKey`. JS page `js/pong.html`.