The Math Behind Griddle: How the Board Is Generated

Mathematical formulas flowing into a Griddle board showing seeded generation

One of Griddle's defining features is that every player gets the same board each day — no server needed. If you've ever wondered how that works, this post explains the math and computer science behind Griddle's daily board generation. Don't worry, no programming knowledge required — we'll keep it approachable.

The Core Idea: Seeded Randomness

Griddle's boards look random, and in a sense they are — you can't predict what letters you'll get tomorrow. But they're generated using a technique called seeded pseudorandom number generation (seeded PRNG), which is actually deterministic: given the same starting value (the "seed"), it always produces the same sequence of numbers.

Think of it like a recipe. If two people follow the same recipe with the same ingredients, they get the same dish. A seeded PRNG is a mathematical recipe that takes a number (the seed) and produces a long sequence of seemingly random numbers. As long as the seed is the same, the sequence is identical — every time, on every device, anywhere in the world.

From Date to Seed

Griddle's seed is derived from the calendar date. The game takes today's date and converts it into an integer using a simple format: YYYYMMDD. For example:

This integer becomes the seed. Since every player's device knows today's date, every player computes the same seed, which generates the same board. No server coordination needed — the calendar itself is the shared state.

Why this works without a server: Traditional online games would store the daily puzzle on a server and send it to each player. Griddle skips this entirely. The puzzle is computed from the date on your device. Two phones on opposite sides of the world running the same algorithm with the same date will produce identical boards, bit for bit.

The Algorithm: Mulberry32

Griddle uses a well-known PRNG algorithm called Mulberry32. It's a 32-bit generator that takes a seed and produces a sequence of numbers between 0 and 1, similar to JavaScript's built-in Math.random() — except that Math.random() isn't seedable (you can't control what sequence it produces), while Mulberry32 is.

The algorithm is compact — just a few lines of code — but mathematically robust enough to produce sequences that pass standard randomness tests. The numbers it generates look random to human eyes and are distributed uniformly, which matters for fair tile selection.

Building the Board

Once the PRNG is seeded with today's date, Griddle uses it to build the board in several steps:

Step 1: Draw 36 Tiles From the Pool

Griddle maintains a weighted tile pool where common letters (E, A, I, T, etc.) have many copies and rare letters (Q, Z, J, X) have few. The PRNG draws 36 tiles from this pool using weighted random selection. The weighting ensures that most boards have a playable distribution of vowels and consonants, while occasionally producing boards with interesting rare letters.

Step 2: Place Tiles on the Grid

The 36 drawn tiles are placed into the 6×6 grid positions. The PRNG determines the arrangement, producing a specific layout that defines which letters are adjacent to which — and critically, which letters land on the four bonus square positions.

Step 3: Fix the Bonus Squares

The four bonus squares (Double Letter, Triple Letter, Double Word, Triple Word) are at fixed positions on the grid. They don't move or change between games. Whatever letter happens to land on those positions gets the multiplier benefit. This means the PRNG indirectly controls scoring potential — a high-value letter on Triple Word is pure luck of the draw, determined by the date's seed.

Shuffling: Same Letters, New Arrangement

When you submit a word or press Shuffle, the board rearranges. This uses the same PRNG, continuing from where it left off in the sequence. The shuffle algorithm is a Fisher-Yates shuffle — a standard algorithm that produces a uniformly random permutation of the 36 tiles.

Importantly, shuffling only rearranges the tiles' positions. The same 36 letters stay on the board, and the four bonus square positions remain fixed. What changes is which letters happen to be adjacent to which — opening up new word possibilities that the previous layout didn't support.

Because shuffles continue the PRNG sequence, two players who submit the same words in the same order would see the same shuffle results. In practice, players diverge almost immediately (different first word → different shuffle → different second word → ...), so each player's game experience is unique even though the starting board is shared.

Bonus Games: Unique Seeds

After completing the daily game, you can play unlimited bonus rounds. Each bonus game gets a unique seed derived from the daily seed plus a replay counter, ensuring no two bonus boards are the same. Since the counter increments with each bonus game, you'll never see the same bonus board twice.

Why Not Just Use Math.random()?

JavaScript's built-in Math.random() generates random numbers, but it can't be seeded — there's no way to tell it "start from this specific point in the sequence." This means two different devices calling Math.random() will get completely different numbers.

For Griddle's daily puzzle to work, every device must generate the same board. That requires a seedable PRNG where the seed (the date) guarantees identical output everywhere. Mulberry32 provides this guarantee while being fast enough to run in real time on any device.

The Bigger Picture

Seeded PRNGs are widely used in gaming. Minecraft uses them to generate worlds from a seed string. Roguelike games use them for procedural level generation. Daily puzzle games like Griddle use them to create shared experiences without server infrastructure.

The elegance of this approach is that Griddle has no backend server at all. The game engine, dictionary, board generation, scoring, and stats tracking all run entirely in your browser. The daily puzzle is "stored" in the date itself — a shared clock that every device in the world agrees on.

This architecture means fast load times (no server round-trips), complete privacy (no data sent anywhere), and resilience (the game works even with a spotty connection, as long as the initial page load completes).

A Fun Consequence

Because the board is deterministic, it's theoretically possible to calculate every board into the future. January 1, 2030? There's already a board for that — you just don't know what it looks like yet because you haven't run the algorithm with seed 20300101. The puzzle isn't stored somewhere waiting to be revealed; it's an inevitable mathematical consequence of the date and the algorithm.

That's the beauty of deterministic randomness: it feels surprising every day, but it was always going to be exactly what it is.

Want to see today's board? Play today's Griddle and experience the math in action.