Hi I am just getting into python and I am trying to create a rock paper scissor lizard spock game for 3 people and I cannot figure out the scoring of the players I attached the code below, any help/ideas is much appreciated.
import random number_of_games = 3 print("Player 1 please choose rock , paper , scissors , lizard, or spock (in lower case please)") choice1 = input("What do you choose? ") player1_choice = str(choice1) print("Player 2 please choose rock , paper , scissors , lizard, or spock (in lower case please)") choice2 = input("What do you choose? ") player2_choice = str(choice2) print("Player 3 please choose rock , paper , scissors , lizard, or spock (in lower case please)") choice3 = input("What do you choose? ") player3_choice = str(choice3) def name_to_number(name): if name == "rock": name = 0 return name elif name == "spock": name = 1 return name elif name == "paper": name = 2 return name elif name == "lizard": name = 3 return name elif name == "scissors": name = 4 return name def number_to_name(number): if number == 0: number = "rock" return number elif number == 1: number = "spock" return number elif number == 2: number = "paper" return number elif number == 3: number = "lizard" return number elif number == 4: number = "scissors" return number player1_number = name_to_number(choice1) player2_number = name_to_number(choice2) player3_number = name_to_number(choice3) while number_of_games > 0: number_of_games -= 1 print("Player 1 choice is: " + player1_choice) print("Player 2 choice is: " + player2_choice) print("Player 3 choice is: " + player3_choice) if (int(player1_number) - player2_number) % 5 >=3: print("Player 1 wins!") elif difference >=2: print("Player 2 wins!") elif difference <=1: print ("Player 3 wins!") elif difference == 0: print("It's a tie! You have %d tries left..." % number_of_games) number_of_games = '' else: print("You lost to the Computer. You have %d games left..." % number_of_games) number_of_games = '' break while number_of_games >0: number_of_games -=1 choice1 = input("What do you choose? ") player1_choice = str(choice1) print("Player 1 choice is: " + player1_choice) choice2 = input("What do you choose? ") player2_choice = str(choice2) print("Player 2 choice is: " + player2_choice) choice3 = input("What do you choose? ") player3_choice = str(choice3) print("Player 3 choice is: " + player3_choice) if difference >=3: print("Player 1 wins!") elif difference >=2: print("Player 2 wins!") elif difference <=1: print ("Player 3 wins!") elif difference == 0: print("It's a tie! You have %d tries left..." % number_of_games) number_of_games = '' else: print("You lost to the Computer. You have %d games left..." % number_of_games) number_of_games = '' break while number_of_games >0: number_of_games -=1 choice1 = input("What do you choose? ") player1_choice = str(choice1) print("Player 1 choice is: " + player1_choice) choice2 = input("What do you choose? ") player2_choice = str(choice2) print("Player 2 choice is: " + player2_choice) choice3 = input("What do you choose? ") player3_choice = str(choice3) print("Player 3 choice is: " + player3_choice) if difference >=3: print("Player 1 wins!") elif difference >=2: print("Player 2 wins!") elif difference <=1: print ("Player 3 wins!") elif difference == 0: print("It's a tie! You have %d tries left..." % number_of_games) number_of_games = '' else: print("You lost to the Computer. You have %d games left..." % number_of_games) number_of_games = '' break _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor