Commit 9721d938 authored by Manasani suraj's avatar Manasani suraj

lucky7 game

parent 948a61ec
import random
MAX_ROLL = 6
def game(pot):
dieRoll1 = random.randrange(1, MAX_ROLL)
dieRoll2 = random.randrange(1, MAX_ROLL)
if dieRoll1 + dieRoll2 == 7:
pot = pot + 4
#print (pot) #debug
else:
pot = pot - 1
#print (pot) #debug
return pot
def main():
pot = int(input("Enter bet or <Enter> to quit: ")) #printing read
roll = 0 #initialize accumulator
biggestRoll = 0
biggestPot = pot #initialize counter
while pot:
while pot > 0:
pot = game(pot)
roll += 1
if pot > biggestPot:
biggestPot = pot
biggestRoll = roll
print(roll, '\t', pot)
print("It took", roll, "rolls to go bankrupt")
print ("Your biggest pot was", biggestPot, "on roll", biggestRoll)
pot = int(input("Enter bet or <Enter> to quit: ")) #cont. read
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment