hn.today

Exponential Behavior in Magic: The Gathering

levineuwirth.org71 points55 comments
Screenshot of Exponential Behavior in Magic: The Gathering

Magic: The Gathering is difficult to implement as software not only because its rules and card interactions are extensive, but because triggered abilities can multiply the work an engine must perform. Levi Neuwirth describes building Arcana, a new rules engine intended to support research into machine-learning play, after finding existing implementations unsuitable for that purpose. A Scute Swarm deck illustrates the danger: once six lands are in play, each land can cause a growing number of Swarms to make more tokens. With two life-gain effects and token- and life-gain doublers, eight land drops produce 6,561 Swarms and 26,240 life. The example shows how quickly ordinary game actions can generate extraordinary outcomes.

The central case is Liliana, the Last Hope’s emblem, which creates Zombies equal to the number already controlled, plus two. Starting from none, each resolution follows the recurrence Zₙ₊₁ = 2Zₙ + 2, yielding 2, 6, 14, 30, and 62 Zombies in the first five resolutions, and 510 after eight. Unlike Scute Swarm, the emblem persists even if all its Zombies are destroyed, so its growth can resume. Arcana represents each new Zombie as a separate token-creation effect, requiring individual processing and rules checks; consequently, engine workload rises alongside the army. To investigate the cost of engine steps and prioritize fixes, Neuwirth describes testing 64 Pioneer decks in 4,032 matchup-and-play-order combinations, repeating the lineup 100 times. The supplied material ends before reporting those measurements.

Read on levineuwirth.org55 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.