Skip to content

Instantly share code, notes, and snippets.

@EhsanKia
Created May 27, 2014 19:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EhsanKia/d8f604801ee49790eee9 to your computer and use it in GitHub Desktop.
Save EhsanKia/d8f604801ee49790eee9 to your computer and use it in GitHub Desktop.
from random import shuffle
def trial():
# Deck comprised of 30 cards, two of each. Assume:
# 0=Lightwarden, 1=CoH, 2=Pyromancer, 3=Silence
deck = range(15) + range(15)
shuffle(deck)
# Initial 4 draws
hand = [deck.pop() for i in range(4)]
# You need both 0 on turn 1
# You need both 1 by turn 2
# You need one of 2 and 3 by turn 2
to_draw = 0
new_hand = []
for index, card in enumerate(hand):
# Card we don't care about, or duplicate of 2/3
if card > 3 or (card in [2, 3] and hand.index(card) < i):
to_draw += 1
deck.append(card)
else:
new_hand.append(card)
hand = new_hand
# Shuffle deck again
shuffle(deck)
# Muligan draw + 1 turn draw
for i in range(to_draw + 1):
hand.append(deck.pop())
# Check if we have 2 Lightwarden
if hand.count(0) < 2:
return False
# Draw
hand.append(deck.pop())
# Check if we have 2 CoH
if hand.count(1) < 2:
return False
# Check if we have Pyromancer
if 2 not in hand:
return False
# Check if we have Silence
if 3 not in hand:
return False
# Success!
return True
total = 100000000
success = 0
for i in range(total):
success += trial()
print "{}/{}".format(success, total)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment