The engine

A rules engine for Magic: The Gathering, written in Rust, that plays all 540 cards of the Magic Online Vintage Cube. It is fast enough to play millions of games for training, and small enough to run inside your browser.

540 / 540Vintage Cube cards playable
< 2 µsper state transition (measured 0.25 to 1.6 µs)
2,000+executable rules scenarios
8 M+differential checks against a reference semantics

What it does

The engine knows the whole game, not a simplified version of it. The card pool is the Magic Online Vintage Cube list of October 2026: power, fast mana, reanimation, planeswalkers, double-faced cards, sagas, vehicles, alternative costs and all the rest. Every one of the 540 cards can be drafted and played.

Deterministic by design

Given the same random seed and the same decisions, the engine always produces the same game, event for event. A game can therefore be stored as a seed, two decks and a list of choices, and replayed exactly. This makes bugs reproducible, lets search algorithms explore “what if” branches cheaply, and keeps recorded games tiny.

Fast

A state transition (one step of the game: a player choice, a spell resolving, a phase changing) takes between a quarter of a microsecond and about 1.6 microseconds on a laptop processor. A typical game has around 650 transitions. On a twelve-core machine the engine plays more than fifty thousand random games per second. That speed is what makes search and self-play possible: an AI that thinks by simulating thousands of continuations needs an engine that is almost free to run.

Tested three ways

Rules scenarios

More than two thousand small, executable scenarios each set up a board, perform actions and check the outcome against the Comprehensive Rules: a burn spell in response to a pump spell, a creature that changes zones and becomes a new object, two replacement effects competing for one event. They run on every change to the engine.

Fuzzing

Random players play huge numbers of games with random Vintage Cube decks while the engine checks invariants after every step: no card in two places, no impossible mana pool, no game that never ends, every recorded game replaying identically. Fingerprints of these runs detect any unintended change in behaviour.

A reference semantics

Cards are written in Grimoire, a small language with a precise meaning defined by a minimal core of eight operations. An independent interpreter of that core is compared with the fast engine on states drawn from random games: more than eight million comparisons so far, every divergence traced to a rule of the game before it is accepted. The details are in the research articles.

In your browser

The same Rust code is compiled to WebAssembly and runs in a background thread of your browser, together with the draft bots and the trained networks. Nothing is sent to a server while you play: the page you load is the whole game.

Play now