Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- drawcount = 0
- bingo = 'no'
- wins = {}
- wincount = 0
- callout = 9999
- global drawlist
- from timeit import default_timer as timer
- start = timer()
- def makecards():
- global cards
- global drawlist
- global drawround
- cards = []
- while len(cards) < 90:
- cards.append(random.sample(range(1, 33), 12))
- drawround = 0
- drawlist = []
- def bingocheck():
- cardnum = 0
- global bingo
- for card in cards:
- cardnum += 1
- if len(card) == 0:
- bingo = 'yes'
- def draw():
- global drawcount
- global drawround
- global drawlist
- drawnum = random.randint(1, 32)
- if drawnum not in drawlist:
- #print (drawnum)
- drawlist.append(drawnum)
- drawcount += 1
- drawround += 1
- for card in cards:
- if drawnum in card:
- card.remove(drawnum)
- def win():
- global wins
- global bingo
- global wincount
- if drawround in wins:
- wins[drawround] += 1
- else:
- wins[drawround] = 1
- bingo = 'no'
- wincount += 1
- def status():
- global wincount
- global callout
- if wincount > callout:
- current = timer()
- print (('Percent', wincount / 100000000))
- print ('Time :' , (current - start))
- callout += 10000
- def game():
- makecards()
- while bingo != 'yes':
- draw()
- bingocheck()
- win()
- status()
- for i in range(100000000):
- game()
- print (wins)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement