Skip to content

Instantly share code, notes, and snippets.

@iemcd
Created December 17, 2021 12:03
Show Gist options
  • Save iemcd/5aefc69f8874f0e961805e6bdeb5a59e to your computer and use it in GitHub Desktop.
Save iemcd/5aefc69f8874f0e961805e6bdeb5a59e to your computer and use it in GitHub Desktop.
MtG Curves
Generates all possible mana curves for a given number of cards n, where:
- There are more 2-drops than any other MV.
- The average MV is equal to 3.
- There are fewer 1-drops and 3-drops than 2 drops, but more than 4-drops.
- There are more 4-drops than 5-drops, more 5-drops than 6-drops, and more 6-drops than 7-drops.
- MV 7 is assumed to be the "top" of the curve. Anything more than MV 7 might as well be MV 7 for our purposes.
#!/usr/bin/python3
import math
n = 60
for n7 in range(0, math.ceil(n/7)+1):
n6max = n - n7
for n6 in range(n7+1, n6max+1):
n5max = n6max - n6
for n5 in range(n6+1, n6max+1):
n4max = n5max - n5
for n4 in range(n5+1, n4max+1):
n3max = n4max - n4
for n3 in range(n4+1, n3max+1):
n2max = n3max - n3
for n2 in range(n3+1, n2max+1):
for n1 in range(n4+1, n2):
if n == n1 + n2 + n3 + n4 + n5 + n6 + n7:
if 0 == 4*n7 + 3*n6 + 2*n5 + n4 - n2 - 2*n1:
print(n1, n2, n3, n4, n5, n6, n7, sep=',')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment