I am just beginning to use python and could use some help! I was working on a rock, paper, scissors game and I wanted to add a restart option once either the human or computer reaches 3 wins.
I have looked all over for some answers but from all the other code I looked at seemed way out of my league or extremely different from what I wrote. I haven't tried using def and classes, which I saw a lot of, and made it look very simple. I know I'm probably going about this in a really round about way but I just want to finish this without completely copying someone's code.
import random
moves = ["Rock", "Paper", "Scissors"]
player_score = 0
computer_score = 0
draws = 0
keep_playing = True
while keep_playing == True:
cmove = random.choice(moves)
pmove = input("What is your move: Rock, Paper, or Scissors?")
print("The computer chose", cmove)
#Logic to game
if cmove == pmove:
print("It's a DRAW!")
elif pmove == "Rock" and cmove == "Scissors":
print("--Player Wins!--")
elif pmove == "Rock" and cmove == "Paper":
print("--Computer Wins!--")
elif cmove == "Paper" and cmove == "Rock":
print("--Player Wins!--")
elif pmove == "Paper" and cmove == "Scissors":
print("--Computer Wins!--")
elif pmove == "Scissors" and cmove == "Paper":
print("--Player Wins!--")
elif pmove == "Scissors" and cmove == "Rock":
print("--Computer Wins!--")
#Scoreboard
if pmove == cmove:
draws = draws + 1
print("Player:" + str(player_score) + ' | ' + "Computer:" + str(computer_score) + ' | ' + "Draws:" + str(draws))
if pmove == "Rock" and cmove == "Scissors":
player_score = player_score + 1
print("Player:" + str(player_score) + ' | ' + "Computer:" + str(computer_score) + ' | ' + "Draws:" + str(draws))
if pmove == "Rock" and cmove == "Paper":
computer_score = computer_score + 1
print("Player:" + str(player_score) + ' | ' + "Computer:" + str(computer_score) + ' | ' + "Draws:" + str(draws))
if pmove == "Paper" and cmove == "Rock":
player_score = player_score + 1
print("Player:" + str(player_score) + ' | ' + "Computer:" + str(computer_score) + ' | ' + "Draws:" + str(draws))
if pmove == "Paper" and cmove == "Scissors":
computer_score = computer_score + 1
print("Player:" + str(player_score) + ' | ' + "Computer:" + str(computer_score) + ' | ' + "Draws:" + str(draws))
if pmove == "Scissors" and cmove == "Paper":
player_score = player_score + 1
print("Player:" + str(player_score) + ' | ' + "Computer:" + str(computer_score) + ' | ' + "Draws:" + str(draws))
if pmove == "Scissors" and cmove == "Rock":
computer_score = computer_score + 1
print("Player:" + str(player_score) + ' | ' + "Computer:" + str(computer_score) + ' | ' + "Draws:" + str(draws))
#Win/lose restart point?
if player_score == 3:
print("-----You Win!-----")
break
if computer_score == 3:
print("-----You Lose!-----")
break
I want the code to end saying, "You Win!" or "You Lose!"and then ask for an input to whether or not they want to restart and then it resets the scores and keeps going or if they say no it breaks.