PlayPendium
Contraption · Food for Thought

A level that proves itself solvable

The game never hand-authors a puzzle. It grows one from a single number, and then it plays that puzzle against itself to make sure it is neither trivial nor impossible before you ever see it.

Today's date 1 number, hashed to a seed
becomes
The daily puzzle 1 identical field for everyone
01 · Everything from one number

A whole world folded into a seed

A Contraption level is not stored anywhere. There is no file listing where the goal sits or how the ledges are arranged. Instead the entire level, the ball's start, the goal's position, the number and placement of the fixed walls, the inventory of parts you are handed, is computed from a single starting number called a seed. Feed the generator the same seed and you get, byte for byte, the same puzzle.1

That is possible because the generator's only source of "randomness" is a small deterministic pseudo-random number generator. The one Contraption uses is mulberry32, a compact 32-bit generator authored by Tommy Ettinger, you can spot it by its signature constant, 0x6d2b79f5, added to the state on every draw.2 It is fast, it fits in a few lines, and, crucially, it is not random at all: it is a fixed mathematical sequence that merely looks shuffled. Give it a start and it produces the same stream of numbers forever. The generator then reads that stream to decide where to put everything.

02 · The daily puzzle

How a date becomes a shared challenge

The Daily mode leans on this determinism to do something social. Its seed is not random, it is manufactured from the calendar. The game takes today's date in universal time, writes it into a short string like "contraption:2026-7-28", and runs that text through a hash function to boil it down to one 32-bit number.1

The hash is FNV-1a, a well-known non-cryptographic mixer: it starts from a fixed offset, the decimal 2166136261, or 0x811c9dc5, and for each character folds the letter in with an exclusive-or and then multiplies by the FNV prime 16777619.3 That leaves a number that is stable for a given day and wildly different from one day to the next, so a one-character change in the date scatters the seed completely. Because the calendar is the same for everyone, so is the seed, and so is the puzzle. Two strangers on opposite sides of the world open Daily and face the identical field, which is exactly what makes comparing a score meaningful.

The daily challenge is fair not because a server sends everyone the same level, but because everyone's copy independently recomputes the same level from the same date.

03 · The generator second-guesses itself

Rejecting the puzzle that solves itself

Random geometry is easy; good random geometry is not. A generator that just scatters a goal and some ledges will sometimes produce a level where the ball, dropped from the top, simply falls straight into the goal on its own. That is not a puzzle, it is a cutscene. So before Contraption accepts a candidate world, it runs a quiet test the code calls preSolved: it simulates the level with zero parts placed and checks whether the bare ball reaches the goal by gravity alone. If it does, the level is thrown out and the generator rolls again.1

This is a subtle inversion of how you normally think about a physics engine. The same simulate() function that plays out your machine is being turned inward, at generation time, to audit the level's own difficulty. The engine is both the referee of your solution and the quality inspector of the puzzle.

04 · A tiny solver, built in

"Can this be done with one part?"

Rejecting the too-easy level is only half the job. The other danger is the impossible level, a goal tucked somewhere no arrangement of parts can reach. Contraption guards against this with a small brute-force solver named plausiblySolvable. It does not think cleverly. It just tries.1

Specifically, it sweeps a single ramp across a grid of positions over the field and, at each spot, tries it tilted four different ways. For every one of those trial placements it runs the full simulation and asks: did that one ramp route the ball home? The moment any placement succeeds, the level is declared solvable and shipped to you. If none of them work after the whole sweep, the generator prefers to discard the level and try a fresh seed.

The one-part solver's search, a coarse grid, four tilts each
Sweep parameterRangeMeaning
Ramp X15 → 85, step 14columns across the field
Ramp Y30 → 120, step 18rows down the field
Angles tried4±0.45 and ±0.8 radians
Test per placement1 full simdoes the ball reach goal?

It is worth being honest about what this proves, because the code is honest about it too: the comment calls it a "cheap plausibility check … not exhaustive." A level that passes definitely has at least one crude single-ramp solution. A level that fails might still be solvable with a fan, a gear, or a cleverer ramp the grid never tried, so the generator does not treat failure as proof of impossibility. It keeps the first non-trivial world it found as a fallback, and if forty attempts go by without a clean one-part solution, it ships that fallback rather than looping forever. The result is a pragmatic guarantee: never a free win, almost always a genuine path in, and never an infinite wait for the "perfect" level.1

05 · The deep idea

Generate-and-test, the humblest kind of intelligence

Step back and Contraption's level maker is a clean example of a very old and very general problem-solving pattern: generate and test. Propose a candidate at random; check it against your requirements; keep it if it passes, discard and re-propose if it fails. It is the loop behind procedural content in countless games, behind much of evolutionary computation, and, with a squint, behind natural selection itself: mutation proposes, the environment tests, survivors persist.4

What makes Contraption's version elegant is that the test is not a cheap proxy for playability, it is playability. The generator does not estimate whether a level is fair by counting ledges or measuring distances. It literally plays the level, twice: once empty to make sure it is not a giveaway, and once with a probing ramp to make sure a path exists. The same deterministic physics that will judge your solution is the physics that vetted the puzzle. There is no separate "level validator" that could drift out of sync with the real rules, because there is only one set of rules, used for everything.

And because it is all deterministic, the audit is free of luck in both directions. The daily seed cannot conspire to hand one player an easier field than another, and it cannot hand anyone an unfair one, because before the level is a challenge it has already survived being played, by the game, against itself.

Sources & notes
  1. Seed-to-level generation, the preSolved rejection test, the plausiblySolvable one-ramp solver (grid ranges, four angles, up to 40 attempts, fallback world), and the daily-seed date string are all read directly from Contraption's own game engine and random-number code. Grounded in the game's code, not invented.
  2. mulberry32 is a compact 32-bit pseudo-random generator by Tommy Ettinger; it advances its state with the constant 0x6d2b79f5 and has a period of 2³². Author's reference gist (with his own later caveats on its equidistribution). gist.github.com/tommyettinger/46a874533244883189143505d203312c
  3. "Fowler–Noll–Vo hash function." Wikipedia, the 32-bit FNV offset basis is 2166136261 (0x811c9dc5) and the FNV prime is 16777619 (0x01000193); FNV-1a XORs each byte into the hash first and then multiplies by the prime. en.wikipedia.org/wiki/Fowler–Noll–Vo_hash_function
  4. On generate-and-test / "generation followed by evaluation" as a general search and problem-solving strategy, and its kinship with procedural generation and evolutionary methods. See "Procedural generation," Wikipedia. en.wikipedia.org/wiki/Procedural_generation
  5. Further reading on Procedural generation, [2410.15644] Procedural Content Generation in Games: A Survey with Insights on Emerging LLM Integration. arxiv.org.
  6. Further reading on Procedural generation, Procedural Content Generation in Games: A Survey with Insights on Emerging LLM Integration. doi.org.
  7. Further reading on Procedural generation, "Procedural City Generation with Combined Architectures for Real-time V" by Gr. open.clemson.edu.
Was this worth reading?
Play Contraption
PlayPendium · About · Contact · Privacy · Terms · Cookies · Accessibility · Copyright · Browse all games · Classic arcade games · © 2026