Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- from decimal import *
- getcontext().prec = 7
- ### Generate the Decklist (not randomized)
- decklist = []
- for i in range(0):
- decklist.append(i)
- for i in range(20):
- decklist.append("M")
- for i in range(40):
- decklist.append("B")
- '''
- print
- print "Mountain", decklist.count("M")
- print "Burn=", decklist.count("B")
- print "Total=", len(decklist)
- print
- #'''
- print decklist.count("M"), "/", decklist.count("B")
- def PlayGame(Hand, Deck):
- TurnCounter= 0
- Play = []
- Hand = Hand
- Deck = Deck
- Damage = 0
- while 1:
- TurnCounter +=1
- #print
- #print "Turn=",TurnCounter
- ### Play Mountain
- if "M" in Hand:
- #print "Play Mountain"
- Hand.remove("M")
- Play.append("M")
- ### Play Burn
- for i in range(Play.count("M")):
- if "B" in Hand:
- #print "Damage~!"
- ### CHANGE YOUR BURN CARD VALUE HERE!!!!
- Damage +=2
- Hand.remove("B")
- ### Check for Win
- #print "Damage=", Damage
- if Damage >=20:
- #print
- return TurnCounter
- ### Draw a Card (Starting next turn)
- #print "Draw --- ", Deck[0:1][0]
- Hand.append(Deck[0:1][0])
- #print "Hand", Hand
- Deck = Deck[1:]
- def DrawHand(MullCounter):
- ### Create a new instance of the deck and randomize it (mutability issues)
- currentdeck = decklist[:]
- random.shuffle(currentdeck)
- '''
- print 'making Currentdeck Randomized'
- print currentdeck
- print
- #'''
- ### Draw Hand
- Hand = currentdeck[0:MullCounter]
- currentdeck = currentdeck[MullCounter:]
- '''
- print 'Hand is now', Hand
- print
- #'''
- return [Hand, currentdeck]
- ranger = 1000000
- average = 0
- mCounter = 0
- T3, T4, T5, T6, T7, T8, T9, T10, T11, T12 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- for i in range(ranger):
- ### Mulligan Check and Play
- mull=0
- while 1:
- Instance = DrawHand(7-mull)
- Hand = Instance[0]
- #print Hand
- currentdeck = Instance[1]
- #print currentdeck
- if "M" in Hand:
- break
- elif len(Hand) == 3:
- break
- else:
- mull +=1
- mCounter +=1
- killturn = PlayGame(Hand, currentdeck)
- average = average + killturn
- if killturn == 3:
- T3 +=1
- if killturn == 4:
- T4 +=1
- if killturn == 5:
- T5 +=1
- if killturn == 6:
- T6 +=1
- if killturn == 7:
- T7 +=1
- if killturn == 8:
- T8 +=1
- if killturn == 9:
- T9 +=1
- if killturn == 10:
- T10 +=1
- if killturn == 11:
- T11 +=1
- if killturn == 12:
- T12 +=1
- """
- print "From Range of ", ranger
- #print "T3=",(Decimal(T3) / Decimal(ranger)) * 100
- print "T4=",(Decimal(T4) / Decimal(ranger)) * 100
- print "T5=",(Decimal(T5) / Decimal(ranger)) * 100
- print "T6=",(Decimal(T6) / Decimal(ranger)) * 100
- print "T7=",(Decimal(T7) / Decimal(ranger)) * 100
- print "T8=",(Decimal(T8) / Decimal(ranger)) * 100
- print "T9=",(Decimal(T9) / Decimal(ranger)) * 100
- print "T10=",(Decimal(T10) / Decimal(ranger)) * 100
- print "T11=",(Decimal(T11) / Decimal(ranger)) * 100
- print "T12=",(Decimal(T12) / Decimal(ranger)) * 100
- #"""
- #print "mull count ", mCounter
- print "The average turn you win ", (Decimal(average) / Decimal(ranger))
Add Comment
Please, Sign In to add comment