From 9b5f01ab8b5701e1e3222ab6a29f728f82fbc0cb Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Wed, 22 Sep 2010 21:24:53 -0400 Subject: [PATCH] Update draw_probability to take the deck card count, rather than the deck itself --- analyze.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/analyze.py b/analyze.py index 31fda1e..25cd977 100644 --- a/analyze.py +++ b/analyze.py @@ -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):