How it's made
Procedural puzzle generation
The idea
Circuitry does not ship with pre-made levels. Every puzzle is built in real time by growing a connected wire tree outward from the center tile. The generator picks random directions, assigns tile artwork based on how many connections each cell ends up with, and stores the correct rotation for each piece before scrambling the board for the player.
Toggle Hard Mode below to compare both generators at 700 ms per step. In hard mode, orange is the tile being processed and green tiles sit on the frontier queue. In normal mode, orange steps through the grid left-to-right, one tile at a time. Pause anytime to inspect a step.
Live generation demo
Hard mode — orange = processing, green = queued on the frontier.
The center cell gets three random connections and becomes the power T-junction.
Each active tile picks a valid direction and links to its neighbor, which joins the frontier.
1 connection = node, 2 = straight or L, 3 = T-joint. Types drive both art and solution angle.
Solution rotations are saved, then tiles reset so the player can rotate them into place.
Normal vs. hard generation
The two modes use the same tile rules but different strategies for choosing which cell grows next. That choice changes the shape of the circuit — and I only realized how much when I stumbled into it while optimizing the generator.
Normal mode
Every tick runs a full left-to-right, top-to-bottom scan of the 5×5 grid — row 0 left to right, then row 1, and so on. Any unfinished tile hit during that pass may grow. Because the loop order is fixed, tiles earlier in the scan tend to expand first when several cells are eligible at once. It is simple, but biased toward a predictable sweep direction.
Hard mode
Only tiles on a frontier queue are eligible. When a cell connects outward, its neighbor is pushed onto the queue — and each step picks a random tile from that queue to grow next. There is no fixed scan order; growth wanders through the board in a less predictable path.
Hard mode started as a performance tweak. Scanning all 25 tiles every frame was wasteful, so I tried maintaining a queue of frontier cells and only ticking one per step. I did not set out to change puzzle difficulty — but when I switched back and forth during development, the queue version consistently produced layouts that felt tougher to solve. The random frontier selection creates more branching, less uniform wire paths, and fewer of the easy patterns the left-to-right scan tends to favor. Hard mode stayed in the game as a toggle once I realized the accident was a feature.
- Connections — Directions are encoded 0-3 (up, down, left, right). Each link is reciprocal: connecting up on tile A adds down on tile B.
- Constraints — A tile stops growing at three connections (T-joint) or when every neighbor is blocked. Edge cells naturally cap at fewer links.
- Solution angles — Once the tree is complete, each tile's connection pattern maps to a rotation in degrees. That array is the answer key.
- Normal vs. hard — Normal sweeps the grid in fixed row order; hard randomly picks from the frontier queue. Same rules, different traversal — and noticeably different puzzle feel.
- Visual demo — Toggle hard mode in the demo to watch either the left-to-right scan or random frontier selection at 700 ms per step.
The game hides generation behind a fast timer. The demo exists to make the algorithm legible — the same code path, slowed down and annotated, so you can see randomness become a solvable circuit.