mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-07-15 21:28:33 -05:00
[PR #1949] [MERGED] fix(site): make All-Reduce Rhythm chunks animate, taps flash, and game clean up #32213
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/harvard-edge/cs249r_book/pull/1949
Author: @farhan523
Created: 7/7/2026
Status: ✅ Merged
Merged: 7/10/2026
Merged by: @profvjreddi
Base:
dev← Head:fix/allreduce-game-defects📝 Commits (1)
4924dbafix(site): make All-Reduce Rhythm chunks animate, taps flash, and game clean up📊 Changes
1 file changed (+16 additions, -8 deletions)
View changed files
📝
site/assets/games/allreduce.mjs(+16 -8)📄 Description
Problem
Three defects in the All-Reduce Rhythm mini-game (
site/assets/games/allreduce.mjs):1. Gradient chunks never animate — the game's core visual is broken.
tween()(runtime.mjs:307) has signaturetween(target, prop, from, to, ms, ease). The call passed[chunk.position, chunk.position]astargetwith props["x","y"], so the multi-prop branch assignedx/yonto the array, never ontochunk.position. On every perfect beat a chunk spawned at the source GPU, sat frozen for the whole beat, then vanished with a burst at the destination. The ring-transfer metaphor — data traveling GPU to GPU, the point of the game — never rendered.2. Tap highlight is a no-op.
The GPU box was filled with
COL.gpuand the "flash" settint = 0xffffff(the identity tint in Pixi), then "reset" it to the same0xffffff. Players got zero visual feedback that their tap registered.3. No cleanup on unmount.
Unlike sibling games (
cluster.mjs,pipeline.mjs), the module registered an anonymous globalkeydownlistener and returned nodestroy(). Remounting without a full page reload stacks permanent handlers bound to dead game state and leaks a WebGL context per mount.Fix
tween(chunk, ["position.x", "position.y"], ...)— same pattern asmoe.mjs:82. Also cancel the tween beforechunk.destroy()so the tween's final tick can't touch a destroyed object.COL.gpuat rest (Pixi tints can only darken). The white tint on tap now genuinely flashes the box; the 100 ms reset restoresCOL.gpu. Resting render is pixel-identical (0xffffff × COL.gpu = COL.gpu).handleKeydown+destroy()in the returned object, matching thecluster.mjsconvention: removes the listener and callsapp.destroy(true, { children: true, texture: true }).No scoring, timing, or gameplay logic touched. Verified with
node --check; +16/−8 in one file.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.