Inside our game logic library
Every result in our games comes from one small library. It's the most important code we have, so it's built to be boring in the best way: predictable, exact and easy to check.
One library, two runtimes
The library is pure, synchronous and deterministic. It runs unchanged on our servers and in the player's browser, and its only dependency is a widely used, audited hashing package. The same inputs always produce the same output, on any machine.
No floating point where it matters
Floating-point math can round differently across engines, which is a problem when a browser has to reproduce a server's result exactly. So outcomes are computed in fixed-point integers: 1x is represented as 10,000 units and handled as a big integer. The browser and the server always agree to the last unit.
Errors you can reason about
Input validators never throw. They return either a clean value or a structured error naming the field and the problem. Game engines throw one typed error with a specific code, such as an illegal action or a mismatched random stream, so failures are explicit instead of silent.
Versioned rules
When a game's rules change, the rules version is stored with every round. An old round always verifies under the rules it was played with, and an unknown version is rejected rather than guessed.
Tested like it matters
The library ships with 113 tests. They include reference vectors that the code must reproduce byte for byte, and large statistical simulations that check each game behaves as designed over many rounds.