Task 4 of 5

Watch the Glider Fly

The glider is five cells that travel. No individual cell moves — each one just dies or is born in place, like every other cell — yet after four ticks an identical copy of the pattern stands one cell down and one cell right. Motion as pure side effect. When it was discovered in 1970 it changed the game: Life could transmit information.

Time to see it. You already know both halves from earlier tracks: a numeric step kernel computes generations, and a graphical kernel turns the final grid into pixels. Simulation pass, then render pass — the fundamental division of labor in every real-time visualization.

Goal: complete the paint kernel so live cells glow green and dead cells stay near-black, then watch the glider that started in the top-left arrive further down the board.

Requirements

Hint 1 — numbers in, colors out

cells is the plain 2D grid the step kernel produced. Read cells[this.thread.y][this.thread.x] into a variable — it's 0 or 1.

Hint 2 — the branch
if (alive === 1) {
  this.color(0.2, 1, 0.4, 1);
} else {
  this.color(0.05, 0.06, 0.09, 1);
}

Same idea elsewhere

Sim pass feeding a render pass is the standard split in every API: a WebGPU compute shader writes the state a fragment shader then draws, and CUDA–OpenGL interop exists purely so simulation buffers can be displayed without a round trip through the CPU.

All tasks in Cellular Automata

  1. The Neighbor Census
  2. One Tick of Life
  3. Generations: Feed It Back
  4. Watch the Glider Fly
  5. One Kernel, Every Universe

This page is an interactive exercise — the editor, the GPU runner and your saved progress need JavaScript. The text above is the full brief.