Magic: The Gathering is Turing Complete

Magic: The Gathering is Turing Complete

Alex Churchill Independent Researcher
Cambridge, United Kingdom
   Stella Biderman Georgia Institute of Technology
Atlanta, United States of America
   Austin Herrick University of Pennsylvania
Philadelphia, United States of America

Magic: The Gathering is a popular and famously complicated trading card game about magical combat. In this paper we show that optimal play in real-world Magic is at least as hard as the Halting Problem, solving a problem that has been open for a decade [10, 1]. To do this, we present a methodology for embedding an arbitrary Turing machine into a game of Magic such that the first player is guaranteed to win the game if and only if the Turing machine halts. Our result applies to how real Magic is played, can be achieved using standard-size tournament-legal decks, and does not rely on stochasticity or hidden information. Our result is also highly unusual in that all moves of both players are forced in the construction. This shows that even recognising who will win a game in which neither player has a non-trivial decision to make for the rest of the game is undecidable. We conclude with a discussion of the implications for a unified computational theory of games and remarks about the playability of such a board in a tournament setting.

I Introduction

Magic: The Gathering (also known as Magic) is a popular trading card game owned by Wizards of the Coast. Formally, it is a two-player zero-sum stochastic card game with imperfect information, putting it in the same category as games like poker and hearts. Unlike those games, players design their own custom decks out of a card-pool of over 20,000 cards. Magic’s multifaceted strategy has made it a popular topic in artificial intelligence research.

In this paper, we examine Magic: The Gathering from the point of view of algorithmic game theory, looking at the computational complexity of evaluating who will win a game. As most games have finite limits on their complexity (such as the size of a game board) most research in algorithmic game theory of real-world games has primarily looked at generalisations of commonly played games rather than the real-world versions of the games. A few real-world games have been found to have non-trivial complexity, including Dots-and-Boxes, Jenga and Tetris [8]. We believe that no real-world game is known to be harder than NP previous to this work.

Even when looking at generalised games, very few examples of undecidable games are known. On an abstract level, the Team Computation Game [9] shows that some games can be undecidable, if they are a particular kind of team game with imperfect information. The authors also present an equivalent construction in their Constraint Logic framework that was used by Coulombe and Lynch (2018) [7] to show that some video games, including Super Smash Bros Melee and Mario Kart, have undecidable generalisations. Constraint Logic is a highly successful and highly flexible framework for modelling games as computations.

The core of this paper is the construction presented in Section IV: a universal Turing machine embedded into a game of Magic: The Gathering. As we can arrange for the victor of the game to be determined by the halting behaviour of the Turing machine, this construction establishes the following theorem:

Theorem 1

Determining the outcome of a game of Magic: The Gathering in which all remaining moves are forced is undecidable.

I-a Previous Work

Prior to this work, no undecidable real games were known to exist. Demaine and Hearn (2009) [10] note that almost every real-world game is trivially decidable, as they produce game trees with only computable paths. They further note that Rengo Kriegspiel111Rengo Kriegspiel is a combination of two variations on Go: Rengo, in which two players play on a team alternating turns, and Shadow Go, in which players are only able to see their own moves. is “a game humans play that is not obviously decidable; we are not aware of any other such game.” It is conjectured by Auger and Teytaud (2012) [1] that Rengo Kriegspiel is in fact undecidable, and it is posed as an open problem to demonstrate any real game that is undecidable.

The approach of embedding a Turing machine inside a game directly is generally not considered to be feasible for real-world games [10]. Although some open-world sandbox games such as Minecraft and Dwarf Fortress can support the construction of Turing machines, those machines have no strategic relevance and those games are deliberately designed to support large-scale simulation. In contrast, leading formal theory of strategic games claims that the unbounded memory required to simulate a Turing machine entirely in a game would be a violation of the very nature of a game [9].

The computational complexity of Magic: The Gathering in has been studied previously by several authors. Our work is inspired by [4], in which it was shown that four-player Magic can simulate a Turing machine under certain assumptions about player behaviour. In that work, Churchill conjectures that these limitations can be removed and preliminary work along those lines is discussed in [5]. The computational complexity of checking the legality of a particular decision in Magic (blocking) is investigated in [3] and is found to be coNP-complete. There have also been a number of papers investigating algorithmic and artificial intelligence approaches to playing Magic, including Ward and Cowling (2009) [15], Cowling et al. (2012) [6], and Esche (2018) [11]. Esche (2018) briefly considers the theoretical computational complexity of Magic and states an open problem that has a positive answer only if Magic end-games are decidable.

I-B Our Contribution

This paper completes the project started by Churchill [4] and continued by Churchill et al. [5] of embedding a universal Turing machine in Magic: The Gathering such that determining the outcome of the game is equivalent to determining the halting of the Turing machine. This is the first result showing that there exists a real-world game for which determining the winning strategy is non-computable, answering an open question of Demaine and Hearn [10] and Auger and Teytaud [1] in the positive. This result, combined with Rice’s Theorem [13], also answers an open problem from Esche [11] in the negative by showing that the equivalence of two strategies for playing Magic is undecidable.

This result raises important foundational questions about the nature of a game itself. As we have already discussed, the leading formal theory of games holds that this construction is unreasonable, if not impossible, and so a reconsideration of those assumptions is called for. In section V-A we discuss additional foundational assumptions of Constraint Logic that Magic: The Gathering violates, and present our interpretation of the implications for a unified theory of games.

I-C Overview

The paper is structured as follows. In Section II we provide background information on this work, including previous work on Magic Turing machines. In Section III we present a sketch of the construction and its key pieces. In Section IV we provide the full construction of a universal Turing machine embedded in a two-player game of Magic. In Section V we discuss the game-theoretic and real-world implications of our result.

Ii Preliminaries

One initial challenge with Magic: The Gathering is the encoding of information. Some cards ask players to choose a number. Although rules for how to specify a number are not discussed in the Comprehensive Rules [16], convention is that players are allowed to specify numbers in any way that both players can agree to. For example, you are allowed to choose the number or . This presents an issue brought to our attention by Fortanely [12]. Consider the following situation: both players control Lich, Transcendence, and Laboratory Maniac. One player then casts Menacing Ogre. The net effect of this play is the “Who Can Name the Bigger Number” game – whoever picks the biggest number wins on the spot. This makes identifying the next board state non-computable [2], so we require that any numbers specified by a player must be expressed in standard binary notation.

We believe that with this restriction Magic: The Gathering is transition-computable, meaning that the function that maps a board state and a move to the next board state is computable222We avoid the term “computable game” which is more commonly used to mean that the game has a computable winning strategy.. However, it is unclear how to prove this beyond exhaustive analysis of the over 20,000 cards in the game. We leave that question open for future work:

Conjecture 1

The function that takes a board state and a legal move and returns the next board state in Magic: The Gathering is computable.

In this conjecture we say “a legal move” because it is also not obvious that checking to see if a move is legal is computable. Chatterjee and Ibsen-Jensen [3] show that checking the legality of a particular kind of game action is coNP-complete, but the question has not been otherwise considered. Again, we leave this for future work:

Conjecture 2

There does not exist an algorithm for checking the legality of a move in Magic: The Gathering.

Ii-a Previous Magic Turing Machines

In [4], the author presents a Magic: The Gathering end-game that embeds a universal Turing machine. However, this work has a major issue: it’s not quite deterministic. At several points in the simulation, players have the ability to stop the computation at any time by opting to decline to use effects that say “may.” For example, Kazuul Warlord reads “Whenever Kazuul Warlord or another Ally enters the battlefield under your control, you may put a counter on each Ally you control.” Declining to use this ability will interfere with the Turing machine, either causing it to stop or causing it to perform a different calculation from the one intended. The construction as given in Churchill [4] works under the assumption that all players that are given the option to do something actually do it, but as the author notes it fails without this assumption. Attempts to correct this issue are discussed in Churchill et al. [5].

In this work, we solve this problem by reformulating the construction to exclusively use cards with mandatory effects. We also substantially simplify the most complicated aspect of the construction, the recording of the tape, and reduce the construction from one involving four players to one involving two, and which only places constraints on one player’s deck, matching the format in which Magic is most commonly played in the real world (two-player duels). Like the previous work, we will embed Rogozhin’s (2, 18) universal Turing machine [14].

Iii An Overview of the Construction

In this section we give a big picture view of the Turing machine, with full details deferred to the next section. The two players in the game are named Alice and Bob.

To construct a Turing machine in Magic: The Gathering requires three main elements: the tape which encodes the computation, the controller which determines what action to take next based on the current state and the last read cell, and the read/write head which interacts with the tape under the control of the controller.

Iii-a The Tape

As the rules of Magic: The Gathering do not contain any concept of geometry or adjacency, encoding the tape itself is tricky. Our solution is to have many creature tokens with carefully controlled power and toughness, with each token’s power and toughness representing the distance from the head of the Turing machine. The tape to the left of the Turing machine’s current read head position is represented by a series of creature tokens which all have the game colour green, while the tape to the right is represented by white tokens. Our distance-counting starts at 2, so there is one 2/2 token representing the space currently under the head of the Turing machine; a green 3/3 token represents the tape space immediately to the left of the Turing head, a green 4/4 is the space to the left of that, and so on. Rogozhin’s universal Turing machine starts with the read head in the middle of the tape[14].

To represent the symbols on the tape, we use creature types. We choose 18 creature types from the list of creature types in Magic to correspond to the 18 symbols in Rogozhin’s (2, 18) UTM. We can choose these creature types to begin with successive letters of the alphabet: Aetherborn, Basilisk, Cephalid, Demon, Elf, Faerie, Giant, Harpy, Illusion, Juggernaut, Kavu, Leviathan, Myr, Noggle, Orc, Pegasus, Rhino, and Sliver. For example, a green 5/5 Aetherborn token represents that the 1st symbol is written on the 3rd cell to the left of the head, and a white 10/10 Sliver represents that the 18th symbol is written on the 9th cell to the right of the head. These tokens are all controlled by Bob, except the most recently created token (the space the Turing head has just left) which is controlled by Alice.

Iii-B The Controller

Control instructions in a Turing machine are represented by a table of conditional statements of the form “if the machine is in state , and the last read cell is symbol , then do such-and-such.” Many Magic cards have triggered abilities which can function like conditional statements. The two we shall use are Rotlung Reanimator (“Whenever Rotlung Reanimator or another Cleric dies, create a 2/2 black Zombie creature token”) and Xathrid Necromancer (“Whenever Xathrid Necromancer or another Human creature you control dies, create a tapped 2/2 black Zombie creature token”). We will use both, and the difference between tapped and untapped creature tokens will contribute to the design of the Turing machine.

Each Rotlung Reanimator333For now we will speak about Rotlung Reanimator for simplicity. Some of these will in fact be Xathrid Necromancers as explained in the next section. needs to trigger from a different state being read – that is, a different creature type dying – and needs to encode a different result. Fortunately, Magic includes cards that can be used to edit the text of other cards. The card Artificial Evolution is uniquely powerful for our purposes, as it reads “Change the text of target spell or permanent by replacing all instances of one creature type with another. The new creature type can’t be Wall. (This effect lasts indefinitely.)” So we create a large number of copies of Rotlung Reanimator and edit each one. A similar card Glamerdye can be used to modify the colour words within card text.

Thus, we edit a Rotlung Reanimator by casting two copies of Artificial Evolution replacing ‘Cleric’ with ‘Aetherborn’ and ‘Zombie’ with ‘Sliver’ and one copy of Glamerdye to replace ‘black’ with ‘white’, so that this Rotlung Reanimator now reads “Whenever Rotlung Reanimator or another Aetherborn dies, create a 2/2 white Sliver creature token”444Throughout this paper, card text that has been modified using cards such as Artificial Evolution is written in italics.. This Rotlung Reanimator now encodes the first rule of the program of the (2, 18) UTM: “When reading symbol 1 in state A, write symbol 18 and move left.” The Aetherborn creature token represents symbol 1, the Sliver creature token represents symbol 18, and the fact that the token is white leads to processing that will cause the head to move left.

We similarly have seventeen more Rotlung Reanimators encoding the rest of the program from [14]. Between them they say:

  1. Whenever an Aetherborn dies, create a 2/2 white Sliver.

  2. Whenever a Basilisk dies, create a 2/2 green Elf.

  3. Whenever a dies, create a 2/2

  4. Whenever a Sliver dies, create a 2/2 green Cephalid.

See Table II for the full encoding of the program.

Iii-C The Read/Write Head

The operation “read the current cell of the tape” is represented in-game by forcing Alice to cast Infest to give all creatures 2/ 2. This causes the unique token with 2 toughness to die. It had a colour (green or white) which is irrelevant, and a creature type which corresponds to the symbol written on that cell. That creature type is noticed by a Rotlung Reanimator, which has a triggered ability that is used to carry out the logic encoded in the head of the Turing machine. It produces a new 2/2 token, containing the information written to the cell that was just read.

The Turing machine then moves either left or right and modifies the tokens to keep the tape in order by adding counters to all tokens on one side of the head and 1/ 1 counters to all tokens on the other side. Moving left or right will be accomplished by casting first Cleansing Beam and then Soul Snuffers.

Iii-D Adding a Second State

Everything described so far outlines the operation of one state of the Turing machine. However, our Turing machine requires two states. To accomplish this, we leverage phasing: an object with phasing can ‘phase in’ or ‘phase out’, and while it’s phased out, it’s treated as though it doesn’t exist. We can grant phasing to our Rotlung Reanimators using the enchantment Cloak of Invisibility (“Enchanted creature has phasing and can’t be blocked except by Walls”) and create a second set of Rotlung Reanimators to encode the program . At the moment we read the current cell, exactly one set of Rotlung Reanimators will be phased in.

Objects with phasing phase in or out at the beginning of their controller’s turn, effectively toggling between two states. Accordingly we will arrange for the turn cycle to last 4 turns for each player when no state change occurs, but just 3 turns when we need to change state.

Iv The Full Construction

Now we will provide the full construction of the Magic: The Gathering Turing machine and walk through a computational step. The outline of one step of the computation is as follows (Bob’s turns are omitted as nothing happens during them):

  • Alice casts Infest. Turing processing occurs: a white or green token dies, a new white or green token is created.

  • Alice casts Cleansing Beam, putting two count-ers on the side of the tape we are moving away from.

  • If the Turing machine is remaining in the same state, Alice casts Coalition Victory. If it is changing state, Alice casts Soul Snuffers, putting a 1/ 1 counter on each creature.

  • If the Turing machine is remaining in the same state, this is the point where Alice casts Soul Snuffers. Otherwise, the next computational step begins.

Card Controller Changed text / choices / attachment 29 Rotlung Reanimator Bob See Table II 7 Xathrid Necromancer Bob See Table II 29 Cloak of Invisibility Alice attached to each Rotlung Reanimator 7 Cloak of Invisibility Alice attached to each Xathrid Necromancer Wheel of Sun and Moon Alice attached to Alice Illusory Gains Alice attached to latest tape token Steely Resolve Alice Assembly-Worker 2 Dread of Night Alice Black Fungus Sliver Alice Incarnation Rotlung Reanimator Alice Lhurgoyf, black, Cephalid Rotlung Reanimator Bob Lhurgoyf, green, Lhurgoyf Shared Triumph Alice Lhurgoyf Rotlung Reanimator Alice Rat, black, Cephalid Rotlung Reanimator Bob Rat, white, Rat Shared Triumph Alice Rat Card Controller Wild Evocation Bob Recycle Bob Privileged Position Bob Vigor Alice Vigor Bob Mesmeric Orb Alice Ancient Tomb Alice Prismatic Omen Alice Choke Alice Blazing Archon Alice Blazing Archon Bob
TABLE I: Game state when the (2, 18) UTM begins

Iv-a Beginning a Computational Step and Casting Spells

At the beginning of a computational step, it is Alice’s turn and she has the card Infest in hand. Her library consists of the other cards she will cast during the computation (Cleansing Beam, Coalition Victory, and Soul Snuffers, in that order). Bob’s hand and library are both empty. The Turing machine is in its starting state and the tape has already been initialised.

At the start of each of Alice’s turns, she has one card in hand. She’s forced to cast it due to Bob controlling Wild Evocation, which reads “At the beginning of each player’s upkeep, that player reveals a card at random from their hand. If it’s a land card, the player puts it onto the battlefield. Otherwise, the player casts it without paying its mana cost if able.” When the card resolves, it would normally be put into her graveyard, but Alice is enchanted by Wheel of Sun and Moon, which causes it to be placed at the bottom of her library instead, allowing her to redraw it in the future and keeping the cards she needs to cast in order. After her upkeep step, Alice proceeds to her draw step and draws the card that she will cast next turn.

Alice has no choices throughout this process: she does control one land, but it remains permanently tapped because of Choke (“Islands don’t untap during their controllers’ untap steps”), so she is unable to cast any of the spells she draws except via Wild Evocation’s ability. Neither player is able to attack because they both control a Blazing Archon, “Creatures can’t attack you.”

Bob has no cards in hand and controls Recycle, which reads (in part) “Skip your draw step”. This prevents Bob from losing due to drawing from an empty library.

Iv-B Reading the Current Cell

On the first turn of the cycle, Alice is forced to cast Infest, “All creatures get 2/ 2 until end of turn.” This kills one creature: the tape token at the position of the current read head, controlled by Bob. This will cause precisely one creature of Bob’s to trigger – either a Rotlung Reanimator or a Xathrid Necromancer. Which precise one triggers is based on that token’s creature type and the machine’s current state, corresponding to the appropriate rule in the definition of the (2, 18) UTM. This Reanimator or Necromancer will create a new 2/2 token to replace the one that died. The new token’s creature type represents the symbol to be written to the current cell, and the new token’s colour indicates the direction for the machine to move: white for left or green for right.

Alice controls Illusory Gains, an Aura which reads “You control enchanted creature. Whenever a creature enters the battlefield under an opponent’s control, attach Illusory Gains to that creature.” Each time one of Bob’s Rotlung Reanimators or Xathrid Necromancers creates a new token, Illusory Gains triggers, granting Alice control of the newest token on the tape, and reverting control of the previous token to Bob. So at any point Bob controls all of the tape except for the most recently written symbol, which is controlled by Alice.

Rogozhin’s program Card text
Whenever an Aetherborn dies, create a 2/2 white Sliver
Whenever a Basilisk dies, create a 2/2 green Elf
Whenever a Cephalid dies, create a 2/2 white Sliver
Whenever a Demon dies, create a 2/2 green Aetherborn
Whenever an Elf dies, create a 2/2 white Demon
Whenever a Faerie dies, create a 2/2 green Harpy
Whenever a Giant dies, create a 2/2 green Juggernaut
Whenever a Harpy dies, create a 2/2 white Faerie
Whenever an Illusion dies, create a 2/2 green Faerie
Whenever a Juggernaut dies, create a 2/2 white Illusion
Whenever a Kavu dies, create a tapped 2/2 white Leviathan
Whenever a Leviathan dies, create a tapped 2/2 white Illusion
Whenever a Myr dies, create a tapped 2/2 white Basilisk
Whenever a Noggle dies, create a 2/2 green Orc
Whenever an Orc dies, create a 2/2 white Pegasus
Whenever a Pegasus dies, create a tapped 2/2 green Rhino
Whenever a Rhino dies, create a 2/2 blue Assassin
Whenever a Sliver dies, create a 2/2 green Cephalid
Whenever an Aetherborn dies, create a 2/2 green Cephalid
Whenever a Basilisk dies, create a 2/2 green Cephalid
Whenever a Cephalid dies, create a 2/2 white Basilisk
Whenever a Demon dies, create a 2/2 green Elf
Whenever an Elf dies, create a 2/2 white Aetherborn
Whenever a Faerie dies, create a tapped 2/2 green Kavu
Whenever a Giant dies, create a 2/2 green Harpy
Whenever a Harpy dies, create a 2/2 white Giant
Whenever an Illusion dies, create a 2/2 green Juggernaut
Whenever a Juggernaut dies, create a 2/2 white Giant
Whenever a Kavu dies, create a tapped 2/2 green Faerie
Whenever a Leviathan dies, create a 2/2 green Juggernaut
Whenever a Myr dies, create a 2/2 green Orc
Whenever a Noggle dies, create a 2/2 green Orc
Whenever an Orc dies, create a 2/2 white Noggle
Whenever a Pegasus dies, create a 2/2 green Sliver
Whenever a Rhino dies, create a tapped 2/2 white Sliver
Whenever a Sliver dies, create a 2/2 white Myr
TABLE II: Full text of the Rotlung Reanimators and Xathrid Necromancers encoding the (2, 18) UTM

Iv-C Moving Left or Right

If the new token is white, the Turing machine needs to move left. To do this we need to take two actions: put a counter on all white creatures (move the tape away from white), and put a 1/ 1 counter on all green creatures (move the tape towards green). We rephrase this instead as: put two counters on all white creatures, and put a 1/ 1 counter on all creatures.

On Alice’s second turn, she casts Cleansing Beam, which reads “Cleansing Beam deals 2 damage to target creature and each other creature that shares a color with it.” Bob controls Privileged Position so none of Bob’s creatures can be targeted by any spell Alice casts. Alice controls some creatures other than the tape token, but they have all been granted creature type Assembly-Worker by a hacked Olivia Voldaren, and Alice controls a Steely Resolve naming Assembly-Worker (“Creatures of the chosen type have shroud. (They can’t be the targets of spells or abilities.)”) This makes it so that the only legal target for Cleansing Beam is the one tape token that Alice controls thanks to her Illusory Gains.

Recall that this token is white if we’re moving left, or green if we’re moving right. Cleansing Beam is about to deal 2 damage to each white creature if we’re moving left, or to each green creature if we’re moving right. Alice and Bob each control a copy of Vigor – “If damage would be dealt to another creature you control, prevent that damage. Put a counter on that creature for each 1 damage prevented this way.” So Cleansing Beam ends up putting two counters on either each white creature or each green creature.

On the last turn of the cycle, Alice casts Soul Snuffers, a 3/3 black creature which reads “When Soul Snuffers enters the battlefield, put a 1/ 1 counter on each creature.” There are two copies of Dread of Night hacked to each say “Black creatures get 1/ 1”, which mean that the Soul Snuffers’ triggered ability will kill itself, as well as shrinking every other creature. The creatures comprising the tape have now received either a single 1/ 1 counter, or two counters and a 1/ 1 counter.

To ensure that the creatures providing the infrastructure (such as Rotlung Reanimator) aren’t killed by the succession of 1/ 1 counters each computational step, we arrange that they also have game colours green, white, red and black, using Prismatic Lace, “Target permanent becomes the color or colors of your choice. (This effect lasts indefinitely.)” Accordingly, each cycle Cleansing Beam will put two counters on them, growing them faster than the 1/ 1 counters shrink them. This applies to each creature except Vigor itself; to keep each player’s Vigor from dwindling, there is a Fungus Sliver hacked to read “All Incarnation creatures have ‘Whenever this creature is dealt damage, put a counter on it.’ ”

Iv-D Changing State

The instruction to change state is handled by replacing seven of Bob’s Rotlung Reanimators with Xathrid Necromancer. These two cards have very similar text, except that Xathrid Necromancer only notices Bob’s creatures dying (this is not a problem, as the active cell of the tape is always controlled by Bob), and that Xathrid Necromancer creates its token tapped.

For example, when the program (State A) sees symbol 1, it writes symbol 18, moves left, and remains in state A. This is represented by a phasing Rotlung Reanimator under Bob’s control saying “Whenever Rotlung Reanimator or another Aetherborn dies, create a 2/2 white Sliver creature token.”

By contrast, when the program sees symbol 11, it writes symbol 12, moves left, and changes to state B. This is represented by a phasing Xathrid Necromancer under Bob’s control saying “Whenever Xathrid Necromancer or another Kavu creature you control dies, create a tapped 2/2 white Leviathan creature token.”

In both cases this token is created under Bob’s control on turn T1, but Alice’s Illusory Gains triggers and grants her control of it. In the case where it’s tapped, that means at the beginning of turn T2, it will untap. This causes Alice’s Mesmeric Orb’s trigger to be put on the stack at the same time as Bob’s Wild Evocation’s trigger (since no player receives priority during the untap step). Alice is the active player, so Alice’s trigger is put on the stack first and then Bob’s[16]; so the Wild Evocation trigger resolves, forcing Alice to cast and resolve Cleansing Beam, before the Mesmeric Orb trigger resolves.

When the Mesmeric Orb trigger does resolve, it tries to put the Coalition Victory from the top of Alice’s library into her graveyard. But Wheel of Sun and Moon modifies this event to put Coalition Victory onto the bottom of her library, just underneath the Cleansing Beam that’s just resolved.

Once all these triggers are resolved, Alice proceeds to her draw step. When the state is not changing, she will draw Coalition Victory at this point, but when the state is changing, that card is skipped and she moves on to draw Soul Snuffers in turn T2’s draw step, so she will cast it on turn T3.

The net result of this is that the computation step is 3 turns long for each player when the state is changing, but 4 turns long for each player when the state is not changing. In the normal 4-turn operation, Bob’s phasing Reanimators and Necromancers will phase in twice and phase out twice, and be in the same state on one cycle’s turn T1 as they were in the previous cycle’s turn T1. But when changing state, they will have changed phase by the next cycle’s turn T1, switching the Turing machine’s state.

Iv-E Out of Tape

The Turing tape can be initialised to any desired length before starting processing. But it is preferable to allow the machine to run on a simulated infinite tape: in other words, to assume that any uninitialised tape space contains symbol 3 (the blank symbol in the (2, 18) UTM), represented by creature type Cephalid. This is accomplished by having the ends of the currently-initialised tape marked by two special tokens, one green Lhurgoyf and one white Rat. Suppose we’ve exhausted all the initialised tape to the left. This means that the casting of Infest on turn T1 kills the Lhurgoyf rather than one of the normal tape types. This does not directly trigger any of the normal Reanimators/Necromancers. Instead, Bob has another Rotlung Reanimator hacked to read “Whenever Rotlung Reanimator or another Lhurgoyf dies, create a 2/2 green Lhurgoyf creature token”, and Alice has a Rotlung Reanimator hacked to read “Whenever Rotlung Reanimator or another Lhurgoyf dies, create a 2/2 black Cephalid creature token.” Bob’s trigger will resolve first, then Alice’s.

First, Bob’s Reanimator trigger creates a new Lhurgoyf just to the left of the current head. (Alice’s Illusory Gains triggers and gives her control of this new Lhurgoyf, but that will soon change.) We have one copy of Shared Triumph set to Lhurgoyf (“Creatures of the chosen type get +1/+1”) so this token arrives as a 3/3.

Second, Alice’s Reanimator trigger now creates a 2/2 black Cephalid under Alice’s control. The same two copies of Dread of Night as before are giving all black creatures 2/ 2, so the black Cephalid will arrive as a 0/0 and immediately die.

The death of this Cephalid triggers one of the regular phasing Reanimators of Bob’s just as if a tape cell containing symbol 3 had been read: a new 2/2 token is created and Illusory Gains moves to that new token. The green Lhurgoyf token serving as an end-of-tape marker has been recreated one step over to the left.

The situation for the white Rat representing the right-hand end of the tape is exactly equivalent. Bob has a Rotlung Reanimator hacked to read “Whenever Rotlung Reanimator or another Rat dies, create a 2/2 white Rat creature token”; Alice has a Rotlung Reanimator hacked to read “Whenever Rotlung Reanimator or another Rat dies, create a 2/2 black Cephalid creature token”; and we have another Shared Triumph set to Rat.

(This algorithm would be a little more complex if reading symbol 3 could cause a state change in the (2, 18) UTM, but thankfully it cannot.)

Iv-F Halting

We choose to encode halting as making Alice win the game.

When the Turing machine doesn’t change state, Alice casts the card Coalition Victory on her third turn. It reads “You win the game if you control a land of each basic land type and a creature of each color.” This normally accomplishes nothing because she controls no blue creatures (Prismatic Lace has been used to give her creatures of all the other colours). She does, however, control one land, and also controls Prismatic Omen, which reads “Lands you control are every basic land type in addition to their other types.” Recall that Choke is in play, preventing her from activating the mana ability of this land.

When the halt symbol is read (symbol 17 in state A), the appropriate phasing Reanimator of Bob’s reads “Whenever Rotlung Reanimator or another Rhino dies, create a 2/2 blue Assassin creature token.” Alice’s Illusory Gains takes control of this Assassin token in the usual way in turn T1. She now meets the condition for Coalition Victory when she casts it on turn T3, and wins the game.

If the encoded machine does not in fact halt then the game has entered an unbreakable deterministic infinite loop, which is specified as a draw by rule 104.4b[16].

  Card Purpose   Card Purpose   Card Purpose
4  Ancient Tomb Bootstrap 1  Rotlung Reanimator Logic processing 1  Xathrid Necromancer Change state
4  Lotus Petal Bootstrap 1  Cloak of Invisibility Logic processing 1  Mesmeric Orb Change state
4  Grim Monolith Infinite mana device 1  Infest Logic processing 1  Coalition Victory Halting device
4  Power Artifact Infinite mana device 1  Cleansing Beam Logic processing 1  Prismatic Omen Halting device
4  Gemstone Array Infinite mana device 1  Soul Snuffers Logic processing 1  Choke Halting device
4  Staff of Domination Draw rest of deck 1  Illusory Gains Logic processing 1  Recycle Remove choices
1  Memnarch Make token copies 1  Privileged Position Logic processing 1  Blazing Archon Remove choices
1  Stolen Identity Make token copies 1  Steely Resolve Logic processing 1  Djinn Illuminatus Simplify setup
1  Artificial Evolution Edit cards 1  Vigor Logic processing 1  Reito Lantern Simplify setup
1  Olivia Voldaren Edit cards 1  Fungus Sliver Logic processing 1  Claws of Gix Simplify setup
1  Glamerdye Edit cards 1  Dread of Night Logic processing 1  Riptide Replicator Set up tape
1  Prismatic Lace Edit cards 1  Wild Evocation Forced play device 1  Capsize Set up tape
1  Donate Edit card control 1  Wheel of Sun and Moon Forced play device 1  Karn Liberated Cleanup after setup
1  Reality Ripple Edit card phase 1  Shared Triumph Infinite tape device 1  Fathom Feeder Cleanup after setup
TABLE III: 60-Card Decklist to play the Turing machine in a Legacy tournament

V Discussion

V-a Consequences for Computational Theories of Games

This construction establishes that Magic: The Gathering is the most computationally complex real-world game known in the literature. In addition to showing that optimal strategic play in Magic is non-computable, it also shows that merely evaluating the deterministic consequences of past moves in Magic is non-computable. The full complexity of optimal strategic play remains an open question, as do many other computational aspects of Magic. For example, a player appears to have infinitely many moves available to them from some board states of Magic. Whether or not there exists a real-world game of Magic in which a player has infinitely many meaningfully different moves available to them has the potentially to highly impact the way we understand and model games as a form of computation.

Indeed, this result raises several interesting philosophical questions about games as a form of computation. Some authors, such as Demaine and Hearn [9], have sought a formal framework for modelling games that is strictly sub-Turing. Unlike the open-world, non-strategic games in which Turing machines have been constructed before, Magic: The Gathering is unambiguously a two-player strategic game like such models attempt to represent. Therefore this result shows that any sub-Turing model is necessarily inadequate to capture all games. Quite the opposite: it seems likely that a super-Turing model of games would be necessary to explain Magic. The naïve extension of Demaine and Hearn’s Constraint Logic to allow for unbounded memory appears to be meaningless, although it’s possible that a clever approach would bring success.

Open Problem 3

Does there exist a generalisation of Constraint Logic that explains the computational complexity of Magic: The Gathering?

Although our construction is reducible to the Halting Problem, the fact that even evaluating a board is non-computable is strongly suggestive that the complexity of strategic play is greater than that. We believe there is strong evidence that the true computational complexity is far higher. In particular, we conjecture:

Conjecture 4

Playing Magic: The Gathering optimally is at least as hard as .

Whether or not it is possible for there to be a real-world game whose computational complexity is strictly harder than is an interesting philosophical question. If not, then this conjecture would imply that Magic: The Gathering is as hard as it is possible for a real-world game to be.

V-B Real-world Playability and Legality

While there are practical difficulties involved with correctly setting up the necessary board state, such as running out of space on your table, a sufficiently tenacious player could set up and execute this construction in a real-world tournament game of Magic: The Gathering. An example 60-card deck that is capable of executing this construction on the first turn of the game and which is legal in the competitive Legacy format can be seen in Table III.

With the correct draw, the deck uses Ancient Tomb and three Lotus Petals to play Grim Monolith and Power Artifact and generate unlimited colourless mana, at which point Staff of Domination draws the rest of the deck and Gemstone Array generates unlimited coloured mana. The deck casts most of the permanents immediately, and uses Stolen Identity to make token copies of them (using Memnarch first on the enchantments like Cloak of Invisibility). The tape is initialised with Riptide Replicator and Capsize. Djinn Illuminatus or Reito Lantern allow repeated casting of the text-modification cards, as well as Reality Ripple which sets the phase of the Rotlung Reanimators and Donate which gives most permanents to Bob. Once everything is set up, Steely Resolve is cast, and then Karn Liberated and Capsize are used to exile all setup permanents and all cards from Bob’s hand, eventually exiling Capsize and Karn Liberated themselves. Now no player has any remaining choices except to let the Turing machine execute.

In addition to the Comprehensive Rules [16], play at sanctioned Magic: The Gathering tournaments is also governed by the Tournament Rules [17]. Some of these rules, most notably the ones involving slow play, may effect an individual’s ability to successfully execute the combo due to concerns about the sheer amount of time it would take to manually move the tokens around to simulate a computation on a Turing machine. This would not be a concern for two agents with sufficiently high computational power, as the Tournament Rules also provide a mechanism called “shortcuts” for players to skip carrying out laborious loops if both players agree on the game state at the beginning and the end of the shortcut.

Vi Conclusion

We have presented a methodology for embedding Rogozhin’s (2, 18) universal Turing machine in a two-player game of Magic: The Gathering. Consequently, we have shown that identifying the outcome of a game of Magic in which all moves are forced for the rest of the game is undecidable. In addition to solving a decade-old outstanding open problem, in the process of arriving at our result we showed that Magic: The Gathering does not fit assumptions commonly made by computer scientists while modelling games. We conjecture that optimal play in Magic is far harder than this result alone implies, and leave the true complexity of Magic and the reconciliation of Magic with existing theories of games for future research.


We are grateful to C-Y. Howe for help simplifying our Turing machine construction considerably and to Adam Yedidia for conversations about the design and construction of Turing machines.


  • [1] David Auger and Oliver Teytaud. The frontier of decidability in partially observable recursive games. International Journal of Foundations of Computer Science, 2012.
  • [2] Stella Biderman and Bjørn Kjos-Hanssen. Non-comparable natural numbers. Theoretical Computer Science Stack Exchange, 2018.
  • [3] Krishnendu Chatterjee and Rasmus Ibsen-Jensen. The complexity of deciding legality of a single step of Magic: The Gathering. In 22nd European Conference on Artificial Intelligence, 2016.
  • [4] Alex Churchill. Magic: The Gathering is Turing complete v5, 2012.
  • [5] Alex Churchill et al. Magic is Turing complete (the Turing machine combo), 2014.
  • [6] Peter I. Cowling Colin D. Ward and Edward J. Powley. Ensemble determinization in Monte Carlo tree search for the imperfect information card game Magic: The Gathering. In IEEE Transactions on Computational Intelligence and AI in Games, volume 4, 2012.
  • [7] Michael J. Coulombe and Jayson Lynch. Cooperating in video games? Impossible! Undecidability of team multiplayer games. In 9th International Conference on Fun with Algorithms, 2018.
  • [8] Erik D. Demaine and Robert A. Hearn. Playing games with algorithms: algorithmic combinatorial game theory. In 26th Symp. on Mathematical Foundations in Computer Science, pages 18–32, 2001.
  • [9] Erik D. Demaine and Robert A. Hearn. Constraint logic: A uniform framework for modeling computation as games. In 2008 23rd Annual IEEE Conference on Computational Complexity, pages 149–162, 2008.
  • [10] Erik D. Demaine and Robert A. Hearn. Games, Puzzles, and Computation. CRC Press, 2009.
  • [11] Alexander Esche. Mathematical Programming and Magic: The Gathering. PhD thesis, Northern Illinois University, 2018.
  • [12] Eugenio Fortanely. Personal communication, 2018.
  • [13] H. G. Rice. Classes of recursively enumerable sets and their decision problems. Trans. Amer. Math. Soc., 74:358–366, 1953.
  • [14] Yurii Rogozhin. Small universal Turing machines. Theoretical Computer Science, 168(2):215–240, 1996.
  • [15] Colin D. Ward and Peter I. Cowling. Monte Carlo search applied to card selection in Magic: The Gathering. In CIG’09 Proceedings of the 5th international conference on Computational Intelligence and Games, pages 9–16, 2009.
  • [16] Wizards of the Coast. Magic: The Gathering comprehensive rules, Aug 2018.
  • [17] Wizards of the Coast. Magic: The Gathering tournament rules, Aug 2018.
Comments 0
Request Comment
You are adding the first comment!
How to quickly get a good reply:
  • Give credit where it’s due by listing out the positive aspects of a paper before getting into which changes should be made.
  • Be specific in your critique, and provide supporting evidence with appropriate references to substantiate general statements.
  • Your comment should inspire ideas to flow and help the author improves the paper.

The better we are at sharing our knowledge with each other, the faster we move forward.
The feedback must be of minimum 40 characters and the title a minimum of 5 characters
Add comment
Loading ...
This is a comment super asjknd jkasnjk adsnkj
The feedback must be of minumum 40 characters
The feedback must be of minumum 40 characters

You are asking your first question!
How to quickly get a good answer:
  • Keep your question short and to the point
  • Check for grammar or spelling errors.
  • Phrase it like a question
Test description