
The mathematics of Magic: the Gathering (1999) - YeGoblynQueenne
http://www.kibble.net/magic/
======
stephengillie
Some time ago, I tried to recreate a few basic Powershell commands as MTG
cards.[0] Try/Catch [1] is one of my favorites - it's designed to "pre-
counter" counterspells.

[0] [https://imgur.com/a/4sa6v](https://imgur.com/a/4sa6v)

[1] _Reveal 2 cards from your hand. Choose 1 and pay its casting cost, then
cast it as normal. If it fails to resolve, reset the game state to before the
card was cast, then cast the second card as normal._
[https://i.imgur.com/E2cbdEo.png](https://i.imgur.com/E2cbdEo.png)

~~~
kace91
>reset the game state to before the card was cast, then cast the second card
as normal. [https://i.imgur.com/E2cbdEo.png](https://i.imgur.com/E2cbdEo.png)

wouldn't that make the card useless?

play cardA -> get countered ->state reset -> play card B -> B gets countered
(because your opponent recovers the counter and untapped cards, due to the
reset).

~~~
Qworg
State reset isn't the right term. You want something like "Reveal two cards
from your hand. Pay the casting cost for one. If it successfully resolves,
exile the second card. If it does not, put the second card into play as if it
were cast."

~~~
ggggtez
As it turns out, that also doesn't work because you can't just put something
into play or it would skip some triggers and activate others it wouldn't
normally. So the code is statefully different if it's in the "catch" instead
of the "try"

------
shiado
I played Magic briefly as a teen and the thing that bothered me the most was
how mana worked and the tendency to either get mana flooded or mana screwed. I
even played a custom format with friends where you separated your deck and
your mana into two decks and drew one from each every turn. It made the game
much more enjoyable and consistent.

~~~
stephengillie
This game mechanic (mana burn) was removed when the rules were refactored
across the past 20 years. Mana (edit:) simply disappears at the end of each
stage.

~~~
BookmarkSaver
He's not talking about mana burn, that was never really a problem except for
extremely niche combo decks. He's talking about when you draw lands/mana
producers for 5 turns in a row after starting with a heavy mana hand. That is
"mana flooding".

~~~
stephengillie
Oh, that's either an issue of an unbalanced deck, or insufficient
randomization.

My best decks started with the "rule of 1/3", and added/trimmed 1-2 lands to
optimize. The "rule of 1/3" is that 1/3 of the deck should be lands, for best
land draw. So a 60 card deck would start with 20 lands, and maybe swap 1-2
forests for elves in an elf deck.

And from a recent card randomizing thread, it takes 7 "riffles" to fully
randomize a deck.

~~~
ufo
20 lands is a little low and is only appropriate if you have a very aggressive
deck, with very few cards costing 3 or more mana.

Conventional wisdom suggests going for around 40% lands. So 24ish lands for 60
card decks, 17ish for a 40 card deck.

~~~
stephengillie
My "blue bertha" decks were 40% to 45% lands. They were usually 100+ cards and
consisted almost exclusively of 6+ casting cost creatures. These were only
used for fun, mostly for other players to test their new decks against, never
in any competition.

Having more than 35% lands leads to the very mana flooding complained about in
the root comment.

~~~
ufo
For a more detailed analysis on land percentages I'd refer to Frank Karsten
(scroll down to the conclusion if you want just the numbers):

[https://www.channelfireball.com/articles/how-many-lands-
do-y...](https://www.channelfireball.com/articles/how-many-lands-do-you-need-
to-consistently-hit-your-land-drops/)

With 35% lands (21/60) you are likely to end up mana-screwed (not enough
lands) unless you build your deck to match the low land count. For a generic
rule of thumb I think it is better to recommend a bit more lands than that.

------
_raoulcousins
For more recent Magic + math writing, see articles by Frank Karsten. Magic the
Gathering Hall of Famer and PhD in game theory.

[https://www.channelfireball.com/tag/frank-karstens-magic-
mat...](https://www.channelfireball.com/tag/frank-karstens-magic-math/)

~~~
ahoy
Karsten made me better at this game, he's a gem.

------
yanowitz
Any discussion of Magic: the Gathering on Hacker News should come with an
ObLink to how it's Turing complete

[https://www.toothycat.net/~hologram/Turing/HowItWorks.html](https://www.toothycat.net/~hologram/Turing/HowItWorks.html)

For more accidentally Turing complete systems, see

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

~~~
YeGoblynQueenne
I know this proof but I'm not happy with it. It goes out of its way to setup a
Turing machine (though not a very obvious one) using M:tG cards- however, that
doesn't prove that the M:tG _game_ is Turing-complete. It proves that the
specific cards chosen can be used to create a Turing machine under a subset of
the game's rules, which is not quite the same thing.

For a more complete proof one needs to take into account the fact that the
text printed on existing cards is a derivation from some grammar - the grammar
of the M:tG "ability text" (there is no official name for the game's
language). In other words, the ability text on existing cards is no the whole
ability text language. The complete language is a superset of the strings on
existing cards. To prove the game as Turing complete, one needs to prove this
language is Turing complete- not a subset of its strings.

To give an analogy, think of the game's rules as the JVM, the ability text
grammar as the syntax of the Java language and the actually printed cards as
some arbitrarily chosen set of Java programs. You can perhaps put together a
Turing machine by stitching together those Java programs, but that will not
tell you anything about the Turing completeness of the language itself.
Instead, the straightforward proof is to use the Java syntax to write a Turing
machine and run it on the JVM.

There is, of course a slight problem with taking this approach for M:tG; that
the game's rules are very well defined (there's the Comprehensive Rules that
go a long way towards resolving any ambiguity) but there is no full
specification for the ability text language itself. So the M:tG machine is not
well defined.

Then again, it's easy to derive at least a subset of the rules of ability
text. For instance, if you see a card that says "Destroy target Elf creature",
and you know that "Elf" is a "creature" type, you can substitute "Elf" for any
creature type and generate any number of very probably correct ability text
sentences- "Destroy target Goblin creature", "Destroy target Cat creature",
"Destroy target Pirate creature" etc [1].

In this way it may be possible to generate the appropriate ability text
expressions to construct a Turing machine- and prove that the M:tG game is
Turing-complete.

________________

[1] Actually the ability to generate arbitrarily many well-formed expressions
in a language is a hallmark of Turing-completeness. If we can't assume that
the ability text on existing, printed cards is not the whole language, then
Turing completeness becomes much harder to argue for.

~~~
rcxdude
For most MtG players, the game rules are the sum of the game rules and the set
of cards which are legal to play. Including other potential card text is not
relevant, or at least at that point you are playing an unofficial variant of
the game. Also, I think constructing a turing machine just under the
comprehensive rules with only ability text is a very simple exercise (even
exluding trivial cases like an ability text which simply instructs you to
evaluate a turing machine as part of the execution). You could probably print
a set of cards to make a usable assembly language, no need for any turing
tarpits, which is another reason why no-one is particularly interested in this
interpretation of the question.

~~~
YeGoblynQueenne
>> For most MtG players, the game rules are the sum of the game rules and the
set of cards which are legal to play. Including other potential card text is
not relevant, or at least at that point you are playing an unofficial variant
of the game.

I dont' think there is any other language for which we assume that the only
strings that belong to it are the sum of its printed texts (which in the case
of M:tG ability text are printed cards). I don't see why we should make this
assumption for ability text. That's not how languages work, in general.

Note that all this has nothing to do with "official" status, or the acceptance
of specific strings by players of the game, or anyone. Either ability text is
some unique construct, the likes of which has never been seen before, or it's
a language like any other and it can be analysed in the same way as any other
language.

~~~
rcxdude
Because when you play mtg, you don't manipulate the words on the cards, you
manipulate the cards (well, some cards can manipulate ability text, but not
arbitrarily). They are the fundamental unit of the game, not the ability text
language itself. This does not have a great analogue with other languages.
Anyway, you can analyse the language used to create ability text itself, but I
think this is a far less interesting question.

------
claudiulodro
How is the MTG scene these days? I spent my childhood through high school
obsessively playing the game, reading these sorts of breakdowns, and spending
all my money. Then life got in the way and I haven't played in about 10 years.
I remember Friday Night Magic used to be a wholesome way to spend a Friday
evening, and you got a lot of entertainment for the $5 entry fee.

~~~
brandnewlow
The latest set, Dominaria, is the best in years. Richard Garfield worked on
it.

Magic: Online is slowly being bled out by Wizards in favor of their new
Hearthstone-like digital client.

That said, the best way to play today is Vintage Cube drafts on Cockatrice.
Free. High level of play. The best cards. There’s almost always a game going.

~~~
lvspiff
>> Vintage Cube drafts on Cockatrice

What/where can I find this? never heard of it and never had much fun/luck with
magic online but would love to be able to play online

~~~
brandnewlow
[https://cockatrice.us/](https://cockatrice.us/)

Install. Log on. Make a deck and join a game or jump into a draft. There's two
Dominaria drafts filling up right now. There's no rules engine and it's a bit
janky at first, but you can play magic against a real human 24/7 for free.

~~~
brandnewlow
Also, the cockatrice drafting community relies on opensource apps like
[http://dr4ft.info](http://dr4ft.info) to run the actual drafts. There's
always room for improvement and anyone can host a fork. It'd be great to get
more HNers tinkering with them.

[https://github.com/dr4fters/dr4ft](https://github.com/dr4fters/dr4ft)

