Update draw_probability to take the deck card count, rather than the deck itself
This commit is contained in:
parent
d5206fc6df
commit
9b5f01ab8b
1 changed files with 4 additions and 4 deletions
|
@ -10,8 +10,8 @@ def h(n, z, x, y):
|
|||
|
||||
def draw_probability(available, deck, count=1, turn=1, used=0):
|
||||
if count == 0:
|
||||
return h(0, 7 + turn - 1 - used, available, len(deck))
|
||||
total = sum([h(n, 7 + turn - 1 - used, available, len(deck)) for n in range(count)])
|
||||
return h(0, 7 + turn - 1 - used, available, deck)
|
||||
total = sum([h(n, 7 + turn - 1 - used, available, deck) for n in range(count)])
|
||||
return 1 - total
|
||||
|
||||
def graph(data, title, hideEmpty=True):
|
||||
|
@ -53,8 +53,8 @@ def rampup(deck, type=None):
|
|||
avgCost = int(round(avgCost))
|
||||
for turn in range(avgCost, maxCost + 1):
|
||||
castable = [c for c in cards if c.cost.converted() <= turn]
|
||||
pm = 1 - draw_probability(len(land), deck, avgCost, turn)
|
||||
pc = 1 - draw_probability(len(castable), deck, 1, turn, avgCost)
|
||||
pm = 1 - draw_probability(len(land), len(deck), avgCost, turn)
|
||||
pc = 1 - draw_probability(len(castable), len(deck), 1, turn, avgCost)
|
||||
p = 1 - pm - pc
|
||||
print 'Probability of drawing {0} mana in {1} turns with a castable {3}: {2:.3f}'.format(avgCost, turn, p * 100, type if type else 'spell')
|
||||
def types(deck):
|
||||
|
|
Loading…
Reference in a new issue