I'm currently writing code for a dice game in Python 3.6 I understand my coding is a little off in this, however, I'm really just wondering how to start my while loop. The instructions of the game are as follows...
A human player plays against the computer.
They take turn rolling two dice, and the totals of the dice are added together Unless a 1 is rolled.
If a one 1 is rolled, you get no score added and it's the next person's turn. If two 1's are rolled, you lose all of your points and its the next person's turn.
The first player to 100 scores, wins the game.
When I run this code, I get the same randomly generated number's over and over. I am not sure how to get different number's on each roll. I also don't understand how to keep up with each player's score at the end of their turn's. Any help at all would be greatly appreciated.
import random
def main():
print("Welcome to the Two Dice Pig Game. You are Player 1!")
Player1 = 0
Player2 = 0
while(Player1<100 or Player2<100):
p1dice=random.randrange(1,7)
p1dice2=random.randrange(1,7)
Player1 = p1dice+p1dice2
print("Player 1 dice 1 =",p1dice)
print("Player 1 dice 2 =",p1dice2)
print("Player 1 dice total =",Player1)
print("Does player 1 want to hold?")
choose1 = input("Enter y for yes or n for no.")
if(choose1=="n"):
print("Player 1 dice 1 =",p1dice)
print("Player 1 dice 2 =",p1dice2)
print("Player 1 dice total =",Player1)
print("Does player 1 want to hold?")
choose1 = input("Enter y for yes or n for no.")
elif(choose1=="y"):
print("It's player 2's turn.")
print("Player 2 dice 2 =",p2dice)
print("Player 2 dice 2 =",p2dice2)
print("Player 2 dice total =",Player2)
print("Does player 2 want to hold?")
choose2 = input("Enter y for yes or n for no.")
main()