Hello, I am new to programming. I am trying to make a dice game called 10,000. Here is the outline or pseudo code. it kind of works. It will roll and keep score, but sometimes it will roll multiple times.
pick a player player one or player two
player rolls six die
if any of the six die are ones or fives
add those scores to active players score
ones are worth 100 points
fives are worth 50 points
player rolls again minus the die that had a value of one or five
example: roll 6 die-values:1,3,2,5,6,4 two of the die hava a value of 1 or 5 so the next roll will
be with 4 die
repeat if with 4 die
if any of the 4 die are ones or fives
add those scores to active players score
ones are worth 100 points
fives are worth 50 points
if any of the rounds does not have a one or five, the turn passes to the next player
Example game:
Player one rolls six die: 1,1,4,6,3,5
player one gets 250 points
player decides if they want to keep the points or risk rolling three die and not getting any ones or fives.
If no ones or fives, turn lost.
player one rolls three die:2,1,4
player one gets 100 points added to score for a total of 350 points
player decides if they want to keep the points or risk rolling two die and not getting any ones or fives.
player one rolls two die and looses points and turn.2,6
player two rolls six die: 5,6,3,3,1,4
player two gets 150 points
player decides if they want to keep the points or risk rolling four die and not getting any ones or fives.
If no ones or fives, turn lost
player rolls four die:1,1,3,5
player two gets 250 added to score for a total of 400 points
player two opts to pass turn and keep points
if a player continues to roll and make ones or fives until the die remaining are 0, player starts over with 6 die.
the game ends when a player reaches 10,000 points
Here is what I have Frankensteined so far:
import random
def rollDice():
roll = []
roll.append(random.randint(1, 6))
roll.append(random.randint(1, 6))
roll.append(random.randint(1, 6))
roll.append(random.randint(1, 6))
roll.append(random.randint(1, 6))
roll.append(random.randint(1, 6))
print "%d,%d,%d,%d,%d,%d" %(roll[0], roll[1], roll[2],roll[3], roll[4], roll[5])
return roll
score=0
response="no"
response=raw_input("\nWould you like a roll?\n")
while response!="no":
if response=="yes"or response=="y"or response=="":
roll=rollDice()
else:
print "That is not a valid response"
response=raw_input("\nWould you like a roll?\n")
if roll[0]==1:
score+=100
print "You got",score,"points"
else:
""
if roll[1]==1:
score+=100
print "You got",score,"points"
else:
""
if roll[2]==1:
score+=100
print "You got",score,"points"
else:
""
if roll[3]==1:
score+=100
print "You got",score,"points"
else:
""
if roll[4]==1:
score+=100
print "You got",score,"points"
else:
""
if roll[5]==1:
score+=100
print "You got",score,"points"
else:
""
if roll[0]==5:
score+=50
print "You got",score,"points"
else:
""
if roll[1]==5:
score+=50
print "You got",score,"points"
else:
""
if roll[2]==5:
score+=50
print "You got",score,"points"
else:
""
if roll[3]==5:
score+=50
print "You got",score,"points"
else:
""
if roll[4]==5:
score+=1
print "You got",score,"points"
else:
""
if roll[5]==5:
score+=50
print "You got",score,"points"
else:
print "Your total score for this round is",score
response=raw_input("\nPress enter to roll again or 'no' to exit the program?")
raw_input=("\enter to exit")
Thanks for your time.