Skip to content

Instantly share code, notes, and snippets.

@ryannow
Last active January 4, 2025 02:03
Show Gist options
  • Save ryannow/361a8faa306c3092ba5cd4db4679a3c8 to your computer and use it in GitHub Desktop.
Save ryannow/361a8faa306c3092ba5cd4db4679a3c8 to your computer and use it in GitHub Desktop.
from random import sample
deck = range(60)
# Rotom is 0-3
# Other basics are 4-12
# Trolley is 13
# FSS is 14-17
# Town Store is 18-21
# Nest is 22
# Ultra is 23
def main():
mulligans = 0
success = 0
failure = 0
for i in range(1000000):
result = draw_hand()
if result == "Mulligan":
mulligans += 1
elif result:
success += 1
else:
failure += 1
print("Mulligans: " + str(mulligans))
print("Successes: " + str(success))
print("Failures: " + str(failure))
print("Successes / non-mulligans: " + str(success / (success + failure)))
def draw_hand():
cards = sample(deck, 14)
opener = cards[:7]
has_basic = False
for c in opener:
if c < 13:
has_basic = True
if not has_basic:
return "Mulligan"
prizes = cards[7:13]
if 13 in prizes:
return False
turn_draw = cards[13]
start_eight = opener + [turn_draw]
if 13 in start_eight:
return True
has_rotom = False
has_fss = False
for c in start_eight:
# Not checking if all 4 Rotom are prized
if c < 4 or c == 22 or c == 23:
has_rotom = True
# Not checking if all 4 FSS are prized either
if (c > 13 and c < 22):
has_fss = True
return has_rotom and has_fss
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment