Hello to whom ever can help me out there.

I have created a game where the player selects on a suit to bet. this suit will be shared among three dice. if the player gets his symbol shown up on all the dice he wins three times the bet amount, if their symbols show up on two dice then the player wins two times the amount amount and so on. however if the player loses, meaning their symbols dont show on any of the three dice rolled the player loses his bet and is minused from the balance.

i am having difficult trying to incorporate the 'while' loop. in other words i dont know how to make the program run continuously unless the user hits the '0' key or the user balance falls below the $0.00 mark.

i have pasted the whole code here.

import random

symbols = { 1:'Crown', 2:'Anchor',3:'Heart',4:'Diamond',5:'Club',6:'Spade' }
print 'Welcome to the Crown and Anchor game where the following numbers pertain to the symbols on each of the three dice.'

betAmount = int(raw_input ('How much would you like to gamble?'))

betSymbol = int(raw_input('''Please select which symbol you would like to gamble on. 1=Crown, 2=Anchor, 3=Heart, 4=Diamond, 5=Club, 6=Spade, 0=Quit'''))

if betSymbol == 0:

print "You picked",symbols[betSymbol]

#Roll the dice
Roll1 = random.randrange(1,7)
Roll2 = random.randrange(1,7)
Roll3 = random.randrange(1,7)
print ''
print symbols[Roll1]
print symbols[Roll2]
print symbols[Roll3]

print ''
balance = 100
print 'Original Balance = $',balance
if Roll1 == betSymbol and Roll2 == betSymbol and Roll3 == betSymbol:
balance = balance + 4*betAmount
elif (Roll1 == betSymbol and Roll2 == betSymbol) or \
(Roll1 == betSymbol and Roll3 == betSymbol) or \
(Roll2 == betSymbol and Roll3 == betSymbol):
balance = balance + 3*betAmount
elif (Roll1 == betSymbol) or (Roll2 == betSymbol) or (Roll3 == betSymbol):
balance = balance + 2*betAmount
balance = balance - betAmount
print 'New Balance = $',balance

raw_input ("\n\nPress the enter key to exit.")

I also need help to include a showMenu() function which displays the following menu.

Your Choices
1. you make a betting selection

2. The computer chooses the symbol(after pressing enter to roll the die.) The game continues until the user balance reaches $200 or the balance is less than the standard bet.

3. until the user presses the '0' key to 'quit'.

if anybody could help, i would most greatly appreciate it.
thankyou and kind regards.

thankyou and kind regards.

7 Years
Discussion Span
Last Post by woooee
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.