TETERI
How TETERI is built
Seeded Randomness: Why Both Players Get the Same Pieces
A small deterministic generator, one shared number, and two identical bags on different machines.
In a duel, both players receive exactly the same sequence of pieces. That is not synchronised over the network — it falls out of a shared seed.
The generator
The game uses mulberry32, a small deterministic pseudo-random generator: it holds a 32-bit state, mixes it with shifts and multiplies, and returns a number between zero and one.
The important property is that the same seed always produces the same sequence, on any machine, in any browser, forever.
How it is used
The seven-bag shuffle draws from that generator rather than from the platform's random function. So the bag order is entirely determined by the seed.
At the start of a match, one side picks a random seed and sends it to the other. Both create their generator from it, both shuffle identically, and both see the same pieces in the same order. No further synchronisation is needed for the rest of the match.
Why this matters for fairness
Without it, a duel has a luck component nobody can see. One player gets a clean sequence, the other gets three S pieces in a row, and the result is partly the randomiser's opinion.
With a shared seed, that argument disappears. Both players faced identical material, so the difference in outcome is entirely the difference in play.
The secondary benefit
Determinism is enormously useful for testing. A test can create a game with a fixed seed and assert on exact outcomes, because the sequence will be the same on every run and every machine.
What is not seeded
The hole columns in garbage rows. Those are decided by the attacking player and transmitted with the attack, so they do not need to be reproducible — and making them reproducible would let a player predict where the gaps in incoming garbage will be, which would be worse.
That is a small design decision with a real consequence, and it is the kind of thing worth thinking about when you introduce determinism anywhere.
Read next
- Every Sound Is Generated, Not RecordedOscillators, filtered noise and a reverb impulse built from decaying random numbers. No audio files anywhere.
- The Soundtrack Is a Sequencer, Not a FileA four-bar progression with drums, bass, arpeggio and a lead, whose tempo and arrangement climb with your level.
- Online Play With No Server At AllWebRTC connects the two browsers directly; a public relay handles only the introduction.
- How the CPU Opponent SearchesEnumerate every placement, score the resulting board on four weighted features, take the best.
- How a 1989 Cartridge Got a World ChampionshipA small side event grew into a competitive scene that repeatedly broke what the game was thought capable of.
- Lock Delay: The Half-Second That Saves Your RunA landed piece does not lock immediately, and nudging it restarts the clock, up to a limit.