0% found this document useful (0 votes)
18 views9 pages

Message

This document contains the code for a rock-paper-scissors game. It begins by prompting the user for their username and displaying the rules. The user can then choose between a normal (rock-paper-scissors) or extended (adds Lizard and Spock) game mode. Based on their selection, the program runs a best-of-5 or best-of-10 match that randomly generates the computer's move and compares it to the user's to determine a winner for each round. After all rounds are completed it displays a message declaring the winner or a tie based on the final scores.

Uploaded by

Chai Cheng Yu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views9 pages

Message

This document contains the code for a rock-paper-scissors game. It begins by prompting the user for their username and displaying the rules. The user can then choose between a normal (rock-paper-scissors) or extended (adds Lizard and Spock) game mode. Based on their selection, the program runs a best-of-5 or best-of-10 match that randomly generates the computer's move and compares it to the user's to determine a winner for each round. After all rounds are completed it displays a message declaring the winner or a tie based on the final scores.

Uploaded by

Chai Cheng Yu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 9

#RPS Code

username = input("Please enter your username: ")


intro = print("Welcome",username, "to Rock, Paper, Scissors!")

print(" ______________________________________________")
print(" | |")
print(" | Rules for Normal Mode: |")
print(" | |")
print(" | | Rock beats Scissors | |")
print(" | | Scissors beats Paper | |")
print(" | | Paper beats Rocks | |")
print(" | |")
print(" | Rules for Extended Mode: |")
print(" | |")
print(" | | Rock beats Scissors | |")
print(" | | Scissors beats Paper | |")
print(" | | Paper beats Rocks | |")
print(" | | Lizard beats Spock | |")
print(" | | Spock beats Scissors | |")
print(" | | Spock beats Rock | |")
print(" | |")
print(" | Good luck and have fun! |")
print(" | |")
print(" | Gamemodes: |")
print(" | -Normal |")
print(" | -Extended |")
print(" | |")
print(" |____________________________________________|")
print(" ")

def play():
#Main Variables
player_score = 0
computer_score = 0

print("Enter choice as Normal or Extended")


print("")
game_mode = str(input("What do you want to play? ")).lower().strip()
print('\033c')

if game_mode == "normal":
print("")
print(" ✂ Welcome to the game ✂
")
print("")
print("RPS normal has been selected")

print("____________________________________________________________________________
______________________________")
print("")
elif game_mode == "extended":
print("")
print(" ✂ Welcome to the game ✂
")
print("")
print("RPS extended has been selected")

print("____________________________________________________________________________
______________________________")
print("")
else:
print("You have made a spelling error please re-run the program")
print("")

print("____________________________________________________________________________
________________________________")
print("")

if game_mode == "normal":
game_format = int(input("How many rounds you want to play? 5 or 10?: "))

if game_format == 5:
print("")
print("")
print("The game is set to the best of 5")

print("____________________________________________________________________________
___________________________")
print("")
elif game_format == 10:
print("")
print("")
print("The game is set to the best of 10")

print("____________________________________________________________________________
___________________________")
print("")
#Randomizer
for i in range(game_format):
player_choice = input("Please pick a choice, Scissors, Paper or Rock:
").lower().strip()
if player_choice == "paper" or "rock" or "scissors":
print("")
import random
moves = ['rock', 'paper', 'scissors']
computer_choice = random.choice(moves)
print ("Computer picks:", computer_choice)
print("")
#Decision making
if computer_choice == player_choice:
print(username, "And Computer has tied, no score is awarded")
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "rock" and computer_choice == "scissors":


player_score +=1
print(username, "Has won and now has a score of" ,player_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "scissors" and computer_choice == "paper":


player_score +=1
print(username, "has won and now has a score of " ,player_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "paper" and computer_choice == "scissors":


computer_score +=1
print("Computer has beaten" ,username, "and now has a score
of" ,computer_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "rock" and computer_choice == "paper":


computer_score +=1
print("Computer has beaten" ,username, "and now has a score
of" ,computer_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "scissors" and computer_choice == "rock":


computer_score +=1
print("Computer has beaten" ,username, "and now has a score
of" ,computer_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "paper" and computer_choice == "rock":


player_score +=1
print(username, "has won and now has a score of " ,player_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

if player_score > computer_score:


print(" \033[1;34;47m Congratulations!\n")
print(" " ,username, "has won! ")
print(" You are on Pole!: ")
print(" ")
print(" ╰(*°▽°*)╯ ")
print(" _/_\_ ")
print(" ___| 1 |___ ")
print(" | 2 | | 3 | ")
print(" ")
print(" WooHoo ")
print(" ")
print(" The score was" ,computer_score, "to" ,player_score)
elif computer_score > player_score:
print(" ")
print(" \033[1;34;47m Computer has won!\n")
print(" You ain't on the podium :( ")
print(" ")
print(" ༼ つ ◕_◕ ༽つ ")
print(" _/_\_ ")
print(" ___| 1 |___ ")
print(" | 2 | | 3 | ")
print(" ")
print(" Better Luck Next time :( ")
print(" The score was" ,computer_score, "to" ,player_score)
elif player_score == computer_score:
print(" ")
print(" \033[1;31;47m Nobody won!\n")
print(" Its time for a rematch! ")
print(" ")
print(" ヽ(ಠ_ಠ) ノ ")
print(" _/_\_ ")
print(" ___| 1 |___ ")
print(" | 2 | | 3 | ")
print(" ")
print(" WooHoo! ")
print(" ")
print(" The score was" ,computer_score, "to" ,player_score)

elif game_mode == "extended":


#Game rounds decider
game_format = int(input("How many rounds you want to play? 5 or 10?: "))

if game_format == 5:
print("")
print("")
print("The game is set to the best of 5")

print("____________________________________________________________________________
___________________________")
print("")
if game_format == 10:
print("")
print("")
print("The game is set to the best of 10")

print("____________________________________________________________________________
___________________________")
print("")
#Randomizer
for i in range(game_format):
player_choice = input("Please pick a choice, Scissors, Paper, Rock, Lizard
or Spock: ").lower().strip()
if player_choice == "paper" or "rock" or "scissors" or "lizard" or "spock":
print("")
import random
moves = ['rock', 'paper', 'scissors', 'lizard', 'spock']
computer_choice = random.choice(moves)
print ("Computer picks:", computer_choice)
print("")
#Decision making
if computer_choice == player_choice:
print(username, "And Computer has tied, no score is awarded")
print("")

print("____________________________________________________________________________
_______________________")
print("")
#section 1 rock
elif player_choice == "rock" and computer_choice == "scissors":
player_score +=1
print(username, "Has won and now has a score of" ,player_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "rock" and computer_choice == "lizard":


player_score +=1
print(username, "has won and now has a score of " ,player_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "rock" and computer_choice == "paper":


computer_score +=1
print("Computer has beaten" ,username, "and now has a score
of" ,computer_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "rock" and computer_choice == "spock":


computer_score +=1
print("Computer has beaten" ,username, "and now has a score
of" ,computer_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")
#section 2 scissors
elif player_choice == "scissors" and computer_choice == "paper":
player_score +=1
print(username, "has won and now has a score of " ,player_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "scissors" and computer_choice == "lizard":


player_score +=1
print(username, "has won and now has a score of " ,player_score)
print("")
print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "scissors" and computer_choice == "spock":


computer_score +=1
print("Computer has beaten" ,username, "and now has a score
of" ,computer_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "scissors" and computer_choice == "rock":


computer_score +=1
print("Computer has beaten" ,username, "and now has a score
of" ,computer_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")
#section 3 paper
elif player_choice == "paper" and computer_choice == "rock":
player_score +=1
print(username, "has won and now has a score of " ,player_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "paper" and computer_choice == "spock":


player_score +=1
print(username, "has won and now has a score of " ,player_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "paper" and computer_choice == "scissors":


computer_score +=1
print("Computer has beaten" ,username, "and now has a score
of" ,computer_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "paper" and computer_choice == "lizard":


computer_score +=1
print("Computer has beaten" ,username, "and now has a score
of" ,computer_score)
print("")
print("____________________________________________________________________________
_______________________")
print("")
#section 4 lizard
elif player_choice == "lizard" and computer_choice == "spock":
player_score +=1
print(username, "has won and now has a score of" ,player_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "lizard" and computer_choice == "paper":


player_score +=1
print(username, "has won and now has a score of" ,player_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "lizard" and computer_choice == "rock":


computer_score +=1
print("Computer has beaten" ,username, "and now has a score
of" ,computer_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "lizard" and computer_choice == "scissors":


computer_score +=1
print("Computer has beaten" ,username, "and now has a score
of" ,computer_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")
#section 5 spock
elif player_choice == "spock" and computer_choice == "rock":
player_score +=1
print(username, "has won and now has a score of" ,player_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "spock" and computer_choice == "scissors":


player_score +=1
print(username, "has won and now has a score of" ,player_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")
elif player_choice == "spock" and computer_choice == "lizard":
computer_score +=1
print("Computer has beaten" ,username, "and now has a score
of" ,computer_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

elif player_choice == "spock" and computer_choice == "paper":


computer_score +=1
print("Computer has beaten" ,username, "and now has a score
of" ,computer_score)
print("")

print("____________________________________________________________________________
_______________________")
print("")

if player_score > computer_score:


print(" \033[1;34;47m Congratulations!\n")
print(" " ,username, "has won! ")
print(" You are on Pole!: ")
print(" ")
print(" ╰(*°▽°*)╯ ")
print(" _/_\_ ")
print(" ___| 1 |___ ")
print(" | 2 | | 3 | ")
print(" ")
print(" WooHoo ")
print(" ")
print(" The score was" ,computer_score, "to" ,player_score)
elif computer_score > player_score:
print(" ")
print(" \033[1;34;47m Computer has won!\n")
print(" You ain't on the podium :( ")
print(" ")
print(" ༼ つ ◕_◕ ༽つ ")
print(" _/_\_ ")
print(" ___| 1 |___ ")
print(" | 2 | | 3 | ")
print(" ")
print(" Better Luck Next time :( ")
print(" The score was" ,computer_score, "to" ,player_score)
elif player_score == computer_score:
print(" ")
print(" \033[1;31;47m Nobody won!\n")
print(" Its time for a rematch! ")
print(" ")
print(" ヽ(ಠ_ಠ) ノ ")
print(" _/_\_ ")
print(" ___| 1 |___ ")
print(" | 2 | | 3 | ")
print(" ")
print(" WooHoo! ")
print(" ")
print(" The score was" ,computer_score, "to" ,player_score)

while True:
print("")
answer = input("Welcome Press Yes to continue and No to quit:
").lower().strip()
if answer == 'yes':
print("")

print("____________________________________________________________________________
_____________________________________")
print("")
play()
elif answer == 'no':
break
else:
print("That was not one of the choices!")

You might also like