Scute Swarm and Liliana's Emblem Break Magic: The Gathering's Exponential Math

Exponential Behavior in Magic: The Gathering

Scute Swarm and Liliana's Emblem Break Magic: The Gathering's Exponential Math

Magic: The Gathering is Turing complete, and its abilities can compound exponentially—making a complete, performant software implementation brutally hard. The author built Arcana, a new rules engine, after judging Forge inadequate for reinforcement learning experiments. Testing it across roughly 400,000 random games, nine jobs hit their two-hour limit. One stalled game traced back to Liliana, the Last Hope: her emblem kept doubling Zombies, and a single resolution took 35 seconds once the army reached the thousands.

The amount of checks that are required to ensure that no further side effects must be put on the stack also grows exponentially, and as we all know, exponential behavior is an enemy of us mere mortal computer scientists.
  1. khaliostr

    There's a bit of an open source Magic renaissance going on lately, which I find really cool.

    Forge has been around forever, but we've managed to get it running in the browser via WASM with Manabrew [1]. I'm one of the maintainers, and we're mostly building it because we wanted a nicer way to play Commander with friends.

    Meanwhile, Phase and Ironsmith are working on new engines in Rust, Gorge is building one in Go alongside a bot and cross-engine testing tools, and people are starting to collaborate across projects.

    Magic is such a ridiculously difficult game to implement that I think it's pretty amazing how many people are tackling it in their spare time.

    If you're into Magic and software engineering, come hang out with us. There's a lot going on and plenty of room for more people to get involved :)

    [1] https://github.com/witchesofthehill/manabrew

  2. gravitronic

    MTGO biggest drawback is you need to pay real money for the virtual cards, and sometimes they cost more than the paper cards themselves.

    Endstep.cc is a newcomer to the field.. it runs the forge engine on the server and allows online play. It is now my favorite place to play my favorite format (pauper)

  3. apitman

    > The game is remarkably complex, even Turing complete, with intricate keywords and a daunting amount of mechanics

    Software engineers can learn a lot from the way complexity exists in MTG. The number of mechanics is huge, but relatively shallow. Once you learn a pretty small set of core rules (tapping, mana, turn phases, the stack, etc), you can add new mechanics to your knowledge easily, usually be reading a small chunk of text.

    You normally only have a handful of mechanics interacting with each other, and usually only need to look up one or two you're not familiar with in a game. It's sort of like a plugin system. Reminds me of Unix too.

  4. amluto

    Surely this particular problem can theoretically be (mostly) addressed by an engine that tracks the number of copies of a given card or stack of cards (card plus attached tokens, etc).

    I say mostly because:

    - Surely there are ways to create N token creatures with a range of counters such that there are still exponentially many different stacks.

    - A fast-enough growing pile could require exponentially many bits to store (or more than exponential).

    But at least the particular problem in the OP could be addressed.

  5. thom

    I feel like this is probably my only opportunity on HN to post this classic:

    https://www.youtube.com/watch?v=AGXG5rNe_tI

More from this day

2026-11-19