How it works
How the generator builds a fair hex board
Short answer
The generator places terrains first, then number tokens, and retries up to a few hundred times until every active rule is satisfied. The whole thing is seeded — the same seed and rule flags always produce the same board.
1. Layout
Two layouts are supported: the classic radius-2 hex (rows of 3-4-5-4-3, totalling 19 hexes), and the 5–6 expansion (rows of 3-4-5-6-5-4-3, 30 hexes). Coordinates use an axial system so adjacency is one of six directions.
2. Terrain pass
The terrain bag — 4 forest, 3 hills, 4 fields, 4 pasture, 3 mountains, and 1 desert in classic mode — is shuffled and placed hex-by-hex. If same resources may touch is disabled, the placer skips any candidate that would create a same-terrain adjacency.
3. Number-token pass
Number tokens (everything except the desert hex) are placed next, with these constraints applied unless their toggles are flipped:
- No two red numbers (6 or 8) adjacent.
- No two extreme numbers (2 or 12) adjacent.
- No identical numbers adjacent.
If a placement is impossible mid-board, the generator restarts the whole attempt with a fresh shuffle. Up to 400 attempts are made before falling back to a relaxed pass.
4. Robber & ports
The robber starts on the desert. Ports are placed at fixed coastal positions per official rulebooks; their resource type and ratio are shuffled.
5. Seed & share
Each board's options (mode, rule flags, RNG seed) are encoded into a short URL-safe string. Visiting /board/<seed> regenerates the exact same board on the server — no database needed.
Algorithm FAQ
How does seed-based map generation work?
A "seed" is a 32-bit integer fed into a deterministic pseudo-random number generator (PRNG). The same seed always produces the same sequence of numbers, which means the same shuffle of terrains, the same shuffle of number tokens, and ultimately the same board. Together with the chosen mode and rule flags, the seed is encoded into a short URL-safe token like /board/3setby9.
Are the random Catan boards truly random?
They are pseudo-random — generated by a deterministic algorithm seeded with a 32-bit integer drawn from a cryptographically-strong source. This means the board is statistically indistinguishable from a true random shuffle, but is reproducible from its seed. The benefit: you can share boards via URL.
What's the difference between random and balanced?
A purely random Catan board can have two reds touching, two 12s touching, three forests in a row — anything goes. A balanced board obeys adjacency constraints: by default the official red-number rule, plus optional rules around extreme numbers, identical numbers, and identical resources. This generator produces balanced random boards by default.
How does the balanced-board algorithm work?
It's a backtracking placer. The terrain bag is shuffled and placed hex-by-hex; if a candidate violates an active rule the placer tries the next item. The number-token pass works the same way. If the placer dead-ends, the entire attempt restarts with a fresh shuffle. Up to 400 attempts are made before falling back to a relaxed pass that guarantees a board.
Why does the URL change when I toggle a rule?
Rule flags are encoded into the seed token, alongside the mode and the RNG seed. So /board/3setby9 with red-touching enabled is a different URL from the same RNG seed without it — the boards differ slightly. This guarantees that anyone who opens the URL sees the exact same board.
Can I generate a Catan map for a specific scenario?
For the four supported modes — Classic, 5–6 expansion, Seafarers, Seafarers 5–6 — yes. Each produces a layout based on the canonical scenario from that mode's rulebook. Custom scenarios (specific Seafarers variants, Cities & Knights variants) aren't directly supported but can use the underlying landmass.
Is the generator open source?
Not currently. The implementation uses a deterministic mulberry32-style PRNG, axial hex-grid coordinates, and a backtracking constraint placer in PHP. We may open-source the core algorithm in future.
How do I make a Catan map for a tournament?
Generate a board with all four adjacency toggles in their default (off) state — that gives you the strict tournament-balanced setup. Share the resulting URL with all participating tables, and everyone plays the exact same map. Print the PNG export if you want a physical reference.
Try it now: classic generator, 5–6 expansion, Seafarers, or Seafarers 5–6.