pop quiz

Grug asks a question from every topic. Say the answer out loud, then tap. Questions you miss return sooner, and questions you know return after a longer gap.

The cards below are a no-script preview. With the page script on, the whole question bank loads from quiz-bank.js and grug draws from it instead.

level 1 of 6Q1 · Where does one frame keep the ball position and both scores?

try first, then show answer

2. A single Game value

why

Game in state.ts:6#aggregate holds both paddles, the ball and the accumulator. A canvas texture holds pixels, and draw never writes scores.

from one value holds the round

level 1 of 6Q2 · When does read_input look at the keyboard?

try first, then show answer

3. Once per drawn frame

why

main.ts:8#read_input calls the reader once, then passes the snapshot to advance. Several steps can share one snapshot.

from one keyboard snapshot per frame

level 5 of 6Q3 · What does draw_game change in the game?

try first, then show answer

1. Nothing in the game

why

draw_game at draw.ts:9#draw_game returns drawing commands and writes no field of Game.

from draw reads, update writes

level 2 of 6Q4 · What does FIXED_STEP set?

try first, then show answer

3. The length of one simulation step

why

FIXED_STEP at update.ts:6#120 is one step of simulation time. Window size and scores live in state.ts.

from time arrives in equal slices

level 2 of 6Q5 · Which velocity changes when the ball meets a paddle?

try first, then show answer

3. vx alone

why

The paddle pass at update.ts:62#hface reverses vx and leaves vy alone. It runs after the horizontal move.

from two collision passes, two answers

level 2 of 6Q6 · The ball leaves past the right edge. Who gains a point?

try first, then show answer

2. The left paddle

why

The right edge test at scoring.ts:9#WINDOW_W adds a point to the left score. A ball that leaves on the left adds a point to the right score.

from a goal changes one score, then waits

level 3 of 6Q7 · What does one Game value give the four files?

try first, then show answer

3. One boundary for reads and writes

why

state.ts:6#aggregate puts the round in one value. update.ts writes that value and draw.ts reads it, so the boundary is visible in function arguments.

from why the state is one plain object

level 3 of 6Q8 · What failure drove the fixed step decision?

try first, then show answer

3. The ball landing differently on two refresh rates

why

The reason note names a 60 Hz screen and a 144 Hz screen in docs/001-fixed-timestep.md:11#60. A variable step makes the same input land at two places there.

from why the loop pays for a fixed step