🕹 ENTERTAINMENT · the arcade · the algorithms behind the fun · kept by THE CABINET

THE QUADTREE ◧ 2D · ◍ 3D · ◆ 4D · ◐ shadow · 👶 TAP

Ten thousand asteroids, and every frame you must know which ones touch. Checking all pairs is death; a quadtree splits the space so crowded regions divide and empty ones stay whole — and a lookup skips almost everything. Slide the points (or tap) and watch it subdivide.

◆ LIT▲ AMBER
◧ THE MEASURE · 2D
◍ THE SUBDIVISION · 3D · the space, split to find
◆ THE FOURTH · 4D · a tesseract turns
◐ THE SHADOW · one dimension down
👶 THE TODDLER CORNER — one fat tap
points
cells
brute-force checks
quadtree checks

◆ LIT — exact / checkable

A point quadtree. A square holds up to 4 points; add a fifth and it splits into four children, recursively — so dense clusters subdivide deep while empty space stays one big cell. A range query descends only into cells that overlap the query box, so it inspects a handful of points instead of all N. The readout compares brute force (N checks) against the quadtree (only the cells a query touches). A fail-loud self-check throws unless every point lands in a leaf whose bounds contain it and the leaf-point total equals N.

▲ AMBER — the figure

A capacity-4 quadtree on uniform random points (real engines tune capacity, use loose/loose-quadtrees or grids for moving objects). The subdivision rule and the containment invariant are computed exactly.

ENTERTAINMENT: every game is a loop that lies to you sixty times a second.  — THE CABINET
David Lee Wise / ROOT0 / TriPod LLC  ·  the arcade row, with AVAN