
Magic: The Gathering is Turing Complete - lelf
https://arxiv.org/abs/1904.09828
======
yorwba
I guess this is newsworthy because a paper was put on arXiv, but the result
has been known for a while. See e.g. this submission a year ago:
[https://news.ycombinator.com/item?id=15712377](https://news.ycombinator.com/item?id=15712377)

~~~
mettamage
I'll just make my submission here then as I don't want to clutter the front
page [1]. The submission includes a list of a lot of things that are
accidentally turing complete _including_ Magic The Gathering.

[1]
[http://beza1e1.tuxen.de/articles/accidentally_turing_complet...](http://beza1e1.tuxen.de/articles/accidentally_turing_complete.html)

~~~
gwern
I have a more up-to-date list at [https://www.gwern.net/Turing-
complete](https://www.gwern.net/Turing-complete)

~~~
eindiran
Why do you consider it surprising that Peano Arithmetic is Turing complete?

~~~
gwern
Because they're supposed to just be the integers. If it is obvious to you that
'the integers' means undecidability/Turing-completeness, and that integers
_without_ multiplication (Presburger) does not, then all I can say is that
your mathematical logic intuition is vastly superior to mine and everyone
before Turing/Godel.

------
baltimore
I'll see your Magic and raise you Nomic:
[https://en.m.wikipedia.org/wiki/Nomic](https://en.m.wikipedia.org/wiki/Nomic)

~~~
vanderZwan
I have never played Nomic, but I can say from experience that Mao is a very
fun way to practice game design skills _and_ troll new players at the same
time

[https://en.wikipedia.org/wiki/Mao_(card_game)](https://en.wikipedia.org/wiki/Mao_\(card_game\))

~~~
meruru
This sounds really cool, but where am I going to find someone who already
knows it to play my first game?

~~~
vanderZwan
Just use the following rules:

\- turns go clockwise

\- play one card per turn

\- if someone breaks a rule, they take back their card and draw one extra

\- first to shed all their cards, followed by saying "Mao!" wins

\- saying "Mao" any other times means drawing three cards (so if someone broke
a rule playing their last card and had to take back their card, they end up
drawing three cards

\- Similar to the previous rule: _not_ saying "Mao" upon successfully playing
the last card also means drawing three cards. And it is breaking the rules, so
the player has to take back the card and draw a card.

\- asking any question means drawing a card (be brutal: _" WHAT?!"_ counts as
a question)

\- one player starts with making up two extra rules

\- the winner of a round makes up a new rule, the old rules stay

... then grab a bunch of friends, say "you'll figure it out", come up with two
rules of your own and start playing. You'll likely win the round (because they
will all ask questions in confusion), and be allowed to add another rule.

Restart after a couple of rounds. Troll until they threaten to quit (at which
point you explain the rules) or until they actually figure it out. Watch their
expressions go from frustration to gleefully anticipation, and go look for a
fresh victim together.

------
C1sc0cat
erm "Though similar to role-playing fantasy games such as Dungeons and
Dragons"

No MTG is not at all similar to role playing games.

~~~
gberger
It is similar in lore/setting.

~~~
C1sc0cat
Not sure that's true MTG is not based on any of the DnD settings nor does it
have Character Races and Classes.

~~~
aloisdg
You have creature type (a list of tags basically). A Human Soldier or a Goblin
Wizard is common in MTG.

~~~
C1sc0cat
You Have a thief in Catan

------
vaylian
Some thoughts about AI: After Chess, Go and StarCraft 1, Magic is definitely
an interesting game for AI to tackle next.

While there are certain play patterns, the space of potential actions is
extremely large and there is a great number of synergistic interactions
between cards that needs to be taken into account.

From an AI perspective Magic is also very hard because it is:

    
    
      * Non-deterministic
      * Partially observable
      * Antagonistic

~~~
shapiro92
but those interactions are actually not as large as a real time game such as
Dota or even Go. Your deck has an X amount of cards and the synergies can be
easily calculated from a machine. The real problem would be, is it smart
enough to beat an unknown opponent deck?

~~~
mratsim
As a Magic player (since 1996) and Go player (since 2004) and also deep
learning scientist, the main issue with Magic is modeling the game. The
interactions and exceptions are really numerous, I expect Magic Arena and
Magic Online are a mess of spaghetti code.

For go modeling basically you have in input an image of the go board, and for
DOTA an image of your screen and the action you have are "limited" and do not
change wildly depending of the state of your screen (except if you're dead on
Dota).

For Magic, you can't just use deep reinforcement learning with an image input,
you need to somehow track the state of your deck, cards, instant effects, what
your opponent did ...

~~~
Qwertystop
Arena at least has the advantage of not including all-cards-ever, only going a
few sets back relative to release. That strips out some of the worst of them.

------
Sahhaese
Does it actually make sense to say that something that is non-computable is
most complex?

That seems like a contradiction.

~~~
theoh
I think you are misunderstanding the article. The point is that when the game
is considered _as_ a computation, the problem of figuring out who is going to
win is not computable. Like every discussion of the halting problem, this is
about whether or not a program exists that can calculate how some other
specific program will behave.

~~~
Sahhaese
I understood that, but question whether it's meaningful to say that is
therefore more complex. Complexity theory just doesn't apply? (Or does it?)

~~~
theoh
Well, it's at least as complex as a Turing machine. That's a statement of
complexity.

Maybe you are asking whether it is possible for the winning strategy of a very
simple deterministic game to be non-computable. In other words, maybe there's
a possible way of defining computability which is orthogonal to complexity.
The CS definitions of both terms are closely connected to Turing machines,
though. Can you imagine a simple deterministic game that couldn't be "solved"
by an algorithm?

------
cosmolev
A collection of things that are Turing-complete by accident
[https://news.ycombinator.com/item?id=16383072](https://news.ycombinator.com/item?id=16383072)

------
kowdermeister
DeepMind engineers are probably getting triggered by this headline :)

~~~
gwern
They'll have to finish solving Hanabi first:
[https://twitter.com/deepmindai/status/1092471486936436736](https://twitter.com/deepmindai/status/1092471486936436736)

------
dagw
The actual article (as opposed to this summary) states that it's the most
computationally complex game, which is quite a different claim.

------
devit
While this paper shows that a player can create a game state where deciding
the game result is Turing-complete, it does not show that doing so is an
optimal strategy under any circumstance (in particular, the setup requires a
starting situation where the player can just win the game instead of
performing the setup).

So it seems perfectly possible (and in fact highly likely) that this result
does not hold if players play optimally, especially if deck selection is
included in the strategy.

~~~
UncleMeat
In game playing theory, an optimal strategy is a function that takes any state
and tells you the proper next move. It does not matter how you got there

For MTG strategy to be computable you must be able to compute whether entering
this computation is a good choice, which requires solving the halting problem.

~~~
manifestsilence
This does mean that MTG is not algorithmically solvable, which is very
interesting. However, in most cases I think it is heuristically trivial to
determine the best move.

~~~
UncleMeat
Sure, but that isn't what theory people care about. Most real world SAT
instances are tractable. But SAT is still NP-Complete.

~~~
manifestsilence
True. There's sort of a divide in this thread over two questions that are
interesting in completely different ways. One is how deep a game MTG is in
practice, and the other is whether it is an algorithmically solvable game
(no). My take-away, other than it being really cool that it's Turing-Complete,
is that any bot will need to accept that not all infinities it could get stuck
in are even detectable and resort to heuristics at a certain point.

------
logfromblammo
So add a new rule:

Choice-lock. If any player is unable to make a choice for some finite
countable number of consecutive turns, they lose.

This could have also prevented combining infinite turn combos with the ante-
related cards to produce "I have created a game state where I can take
ownership all the cards in your deck, and then win," which was fun to do in
the original M:tG PC game, even though running through the combo to actually
take all of the cards was a bit tedious.

~~~
magnat
Now, if only we had algorithm to decide whether for provided game table state,
the chain of triggers ever stops or continues indefinitely.

~~~
logfromblammo
It stops at the Nth instruction, where N is determined by some game designer
to be long enough to create interesting combos, but not so long that one
player can force the other to be their CPU indefinitely.

------
halfdeadcat
Oh good. This will be handy if I ever need to compute FFT's using only Magic
cards.

------
cryptica
I don't understand why researchers are so interested in 'Turing completeness'.
The concept of a Turing machine which operates on a strip of tape is outdated
and no longer intuitive. It would be good if the abstraction of a 'Turing
machine' could be refined into something more modern.

~~~
stellaathena
To be more specific about what the other responses say:

Being "equivalent to a TM" and being "equivalent to the Python compiler" mean
the exact same thing. Pretty much every widely used model of computation is
equivalent in computing power to Turing machines. The notable exceptions are
all _weaker_ than Turing machines, such as arithmetic circuits.

------
lozenge
"By contrast, the chess problem must be solved by brute force, and the number
of steps this takes increases in proportion to an exponential function of the
input. "

What is this input? Board size?

~~~
cluoma
Usually it would be number of legal moves. Of course this would also change
throughout the game as pieces are removed.

~~~
philipov
The number of legal moves is an intermediate calculation. The input is the
initial game state, and the output is usually the number of possible final
game states.

------
lawn
Somehow I highly doubt Magic is the most complex played game in the world.

For instance there are many different card games, what's to say Magic is more
complex than them?

~~~
stellaathena
Did you actually read the paper? There's a mathematical definition of
complexity that is used, and on that metric it is shown to be far harder than
any other previously analyzed game.

~~~
lawn
Yes. The paper is good, the title of the submission was not.

Of course by now the title and even the submission link has completely changed
(it was linked to an article before).

------
hu3
Direct link to the study "Magic: The Gathering is Turing Complete":

[https://arxiv.org/pdf/1904.09828.pdf](https://arxiv.org/pdf/1904.09828.pdf)

~~~
justinmchase
Thank you sir, I am not smart enough to find the direct link from the overview
page linked apparently.

~~~
hu3
You're welcome.

When I posted this, the thread linked to a sensationalist article. The link
was later edited along with the title.

------
thatoneuser
Basic question but what does being Turing complete actually signify? I get the
concept but don't know why it matters.

~~~
mankyd
In theory, if you can perform a computation/algorithm on one turing-complete
device, you can transform it to run on another. That is to say, anything your
desktop computer can do, Magic can do as well (albeit much much _much_
slower).

~~~
vectorEQ
saying anything your computer can do in such a sentence is misleading.
computers are far far away from turing machines these days. they can do much
more. for example, good luck making a socket connection on Magic the
gathering. even if you can compute everything you need with it, you will never
succeed to connect...

~~~
mankyd
That's a statement about the practical engineering involved, yes. However,
saying a computer is "Turing complete" is not misleading. It is purely a
statement of its mathematical properties.

If sockets were given absurd timeouts and/or you could run MtG at much higher
speeds, (and it was given a medium through which it could communicate), it
would have no problem making a socket connection. It is only the practicality
of the matter that becomes a barrier.

------
arey_abhishek
It should be retitled as 'MTG is the most complex game we've played'. I would
counter that other card driven games like Android Netrunner, Terraforming
Mars, Lisboa, Hanabi, etc are just as or even more complex.

~~~
mattashii
I have to disagree on that. At least Terraforming Mars and Hanabi have a
playtime limited by ever-dwindling resources. I don't know the other games,
but I suspect they also have some kind of supply that has a limit in how much
it can be used/aquired.

MTG has ways to return to a previously seen play state, technically allowing a
game to continue infinitely, depending on your deck, of course.

~~~
eru
Loops don't really add complexity. MtG can add now tokens of arbitrary number.
So that can add arbitrary complexity.

------
x0to1
From the paper:

"In this work, we solve this problem by reformulating the construction to
exclusively use cards with mandatory effects."

So it's more a of a subset of MTG's rules. Still, there are commercial video
games out beyond MTG and they've been out for some time. Why has the game
theory field not kept up with them?

~~~
yorwba
> Still, there are commercial video games out beyond MTG and they've been out
> for some time. Why has the game theory field not kept up with them?

Why assume that it hasn't? The paper cites
[http://drops.dagstuhl.de/opus/volltexte/2018/8805/pdf/LIPIcs...](http://drops.dagstuhl.de/opus/volltexte/2018/8805/pdf/LIPIcs-
FUN-2018-14.pdf) which claims to "show the undecidability of whether a team
has a forced win in a number of well known videogames including: Team Fortress
2, Super Smash Brothers: Brawl, and Mario Kart."

------
r34
I'd claim strongly, that any game with:

\- finite number of pieces (eg. cards)

\- finite number of actions each round

\- clear endgame criteria

is computionally solvable. What comes with randomness is stochasticity, but if
that made game unsolvable what about poker (solved for limit heads-up) and
even scrabble?

Probably it's kind of semantic problem. I'm not complexity nor game theory
expert.

~~~
Benjamin_Dobell
Combat resolution/targeting can get a wee bit out of hand:

[https://i.redd.it/wyn3d22evs011.jpg](https://i.redd.it/wyn3d22evs011.jpg)

This is not the worst I've seen, simply what I was able to turn-up on short
notice.

 _EDIT: To clarify (the UI isn 't great), what you see above is a selection of
the "cards" (creatures/tokens) in play, more are off screen._

~~~
Al-Khwarizmi
Maybe the UI isn't great in an absolute sense (that situation would be really
tedious to play), but I don't see how it could be made substantially better.
It wouldn't be better if that situation arose in a physical Magic game
either... the problem there is the game state, not the UI.

~~~
Benjamin_Dobell
My point was that for people that have never seen MtG Arena before, it's non-
obvious that there's more going on off-screen. A more intuitive UI would make
that situation more explicit and not require explanation.

As you've rightly pointed out, a better UI isn't going to solve the UX issue
of ridiculous game state; but it could better depict the state itself.

------
crimsonalucard
Turing completeness in something designed to be domain specific is a sign of
bloat and is a sort of smell. It's a sign of a design taken so far that it now
has the capability to compute anything when in all intents and purposes it's
design is domain specific.

One other example of this is css. Did you know css is Turing complete?

Note that most programming languages are Turing complete because that is the
domain: To express every possible computation in the language, and thus in
these cases Turing completeness is not a design smell.

~~~
hannasanarion
CSS is not turing complete. CSS can do arithmetic, but it has no way to
designate routines or repeat its own behavior.

~~~
crimsonalucard
You are not categorically wrong because I missed some semantics in my
statements. However the essence of what your saying is incorrect.

Let me rephrase more specifically: CSS3 + HTML5 is turing complete. Since CSS
is always used in the context of HTML I left that out, but rigor is important!

source: [https://stackoverflow.com/questions/2497146/is-css-turing-
co...](https://stackoverflow.com/questions/2497146/is-css-turing-complete)

Note that this happened with the later versions of CSS indicating that the
specification became turing complete after years and years of tacking on
features. This is the pattern of bloat accumulating over time.

------
petters
MtG is played by choosing 60 cards from 20k. Everything is finite. There must
be some generalization in order to make it noncomputable.

There are probably many games that can somehow encode a halting problem if the
board size is made arbitrarily large.

EDIT: This from the real abstract sounds very strange:

"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."

~~~
tacone
AFAIK 60 the minimum number of cards you have to put in your deck, but (at the
least at the times) there was not a maximum number.

20k is the number of unique cards, but you can put as much as 4 copies of the
same card in your deck for the vast majority of cards. You can also put as
many "normal" lands as you wish in your deck.

~~~
tapland
As many as you can shuffle unassisted is the upper limit.

~~~
mywittyname
This is an interesting rule, as it seems to provide an advantage to players on
the basis on hand size.

~~~
gpderetta
Unless you really really want a Battle of Wits deck (which is maybe tier 7)
there is really no advantage and quite a bit of a disadvantage to running more
than the minimum allowed number of cards.

~~~
stellaathena
For those who don't play Magic, this is on a scale where tier 1 decks are top
decks, tier 2 decks are reasonable, tier 3 decks have serious weaknesses but
are playable.

------
emilfihlman
Eh, just because you have a big 20000 choose 60 initial set doesn't make it
"most complex".

~~~
rcxdude
Deck building is not the entirety of the decision involved in playing magic.
One of the points in the paper is that the number of decisions in the game is
potentially infinite and that the consequences of those decisions can at lease
in principle be rendered incomputable.

~~~
simonh
And the paper proves that this is true even if all the moves in the game are
forced by cards that give you no choices to make as players.

