Skip to content

angrybacon/gitaxian-probability

Repository files navigation

Gitaxian Probability

This small script computes and attempt at expressing the probability of specific starting 7 cards hands at the beginning of a game of Magic: The Gathering.

While they are incomplete, the slate files tell what scenarii to take into account for each archetype. As opposed to the more standard approach that is to draw at random 7 cards thousands of times and parse for matches, this script counts the actual, theoretical, probability for said matches.

Usage

Tested with Python 3.

Run the scenario suite

python main.py doomsday doomsday.dec -v

Compute the Probability of Having A in N Draws

So you just lost to variance and drew your 6th fetchland out of 11 cards drawn. You’re curious about how likely that event was. It all comes down to counting the sets that verify your criterias and compare them to the total number of different sets you could have got with those 11 draws.

Let’s start by firing up a Python or IPython shell.

from binomial import binomial as b
b(4, 2) * b(4, 4) * b(52, 5) / b(60, 11)
b(4, 2)
We drew 2 copies of Flooded Strand out of the 4 our deck has.
b(4, 4)
We drew the 4 copies of Polluted Delta.
b(52, 5)
The remaining 5 cards to fill with can neither be Polluted Delta nor Flooded Strand. That’s 52 candidates.
b(60, 11)
Our deck is 60 cards, we are counting sets out of 11 cards drawn.

That should give you the theoretical likelihood of having drawn exactly 4 copies of Polluted Delta and 2 copies of Flooded Strand in a total of 11 cards drawn. Note however, that this ignores the possible cantrips you may have resolved before.

Sample Results

Doomsday

$ python .\main.py doomsday .\doomsday.ubr.dec -v
Ignoring Cabal Therapy
Ignoring Daze
Ignoring Duress
Ignoring Lim-Dûl's Vault
Double Cantrip: 0.63%
Draw-3 in Hand: 0.02%
LED in Hand:    0.8%
Brainstorm:     0.3%
Total:          1.75%

Tin Fins

$ python .\main.py tinfins .\bizarro.dec -v
Ignoring Magus of the Mind
Ignoring Mastermind's Acquisition
Ignoring Past in Flames
Entomb in Hand:              4.64%
Griselbrand in Hand:         0.55%
Griselbrand and LED in Hand: 1.53%
Brainstorm and LED in Hand:  0.16%
Total:                       6.89%

Contributing

Contributing with scenarii

This is a work in progress. The current todo consists of actually thinking about which scenarii are missing and implement or fix them.

If you have found a missing scenario for a given form, please do make a pull-request or just PM me through our mutual channels.

Contributing to the Source

Found a bug? Please do let me know. Pull requests work best!

Do remember the Python zen, though:

We are all consenting adults.

Kenneth Reitz

With that being said, you may or may not want to set up your virtual environment. If you don’t know what that is, you probably don’t.

Install some kind of Flake8-compatible linter on your editor, then install the project dependencies.

pip install -r requirements-dev.txt

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages