Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # five_dice.py
- import time
- import os
- import random
- number_of_dice = 5
- matches = { 3: 'Three', 4: 'Four', 5: 'Five' }
- def do_roll():
- pts = 0
- print "\nRolling..."
- time.sleep(1)
- os.system("cls")
- dices = number_of_dice-len(rolls)
- if rolls:
- print "Dices Locked In:", rolls
- for r in range(dices):
- rolls.append(random.randint(1,6))
- print rolls
- print "Multiplier = x"+str(multiplier)
- print
- for roll in set(rolls):
- try:
- c = rolls.count(roll)
- s = matches[c]
- bonus = 100
- if roll is 1:
- bonus = 1000
- pts = roll*c*bonus
- print "You Got", s, "Of A Kind!"
- except:
- 0
- rolls.sort()
- if list(rolls) in (range(1,6),range(2,7)):
- pts = 12000
- print pts, "Potential Points Having Rolled A Straight!"
- print "Overall Potential:", pts+points
- print "Current Score:", score
- return pts
- 0
- while 1:
- os.system("cls")
- print "*** Welcome To 5 Dice! ***"
- score = 0
- for chances in range(10,1,-1):
- multiplier = (10-chances)/2+1
- points = 0
- while 1:
- print "\nSafe Roll With", chances, "Rounds Remaining..."
- raw_input("Press ENTER To Roll ")
- rolls = []
- bonus = do_roll()
- if not bonus:
- print "No Points Found, However...", points, "Points Plus"
- bonus = 2500
- print "A Bonus Of", bonus, "Points, Both x"+str(multiplier)
- print "If You Choose To Lock These Points."
- print chances, "Rounds Remaining..."
- choice = raw_input("Lock These Points? ")
- if choice.lower().startswith("y"):
- score = score+(points*multiplier)+bonus
- print "\nCurrent Score:", score
- break
- else:
- risk = 0
- if choice:
- if choice[0].isdigit():
- risk = choice
- if not risk:
- risk = raw_input("Select Which Dice To Roll Again: ")
- if ' ' in risk:
- risk = risk.split(' ')
- else:
- risk = list(risk)
- print risk
- for r in list(risk):
- try:
- rolls.remove(int(r))
- except:
- 0
- bonus = do_roll()
- points += bonus
- if bonus:
- print "Great Call... You May Now Lock", points, "To Your Score"
- else:
- print "Hah... Zero Points This Round!"
- break
- print "Game Over!\n"
- print "TOTAL SCORE:", score
- choice = raw_input("Would You Like To Play Again? Y/N: ")
- if choice.lower().startswith("n"):
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement