Python Game Rspls
Python Game Rspls
DINODYA THILAKARATHNA
INTRODUCTION
What were we asked to do in this task?
Below are three examples of Python game:The class was asked to design a Python
game or an app using a code editor and
object-orientated programming language
Python.
Students had the option between
manipulating user inputs to create a
python game called a “mad libs
generator,” or even an option like a
“number guessing game.” However, I
chose the rock paper scissors game, or the
rock paper scissors lizard Spock game
which was extended for students aiming
for a higher grade (original game by Sam
Kass). Big Bang Theory mentions the game
for having a less chance at drawing due to
two more options being lizard and Spock.
Furthermore, this was not my original
learning curve for this assessment. Initially
I tried to setup a noughts and crosses
game using PyCharm for a graphics library
which initially did not work. As an
alternative I built the rock paper scissors
lizard Spock game.
BEGINNING SCREEN
An ideal beginning screen has all of the options available for the
player to select. This includes rock paper scissors lizard and Spock
laid out and aligned properly as such:
#5
var1 = input("Do you want to play, or find out why there are more options? (y/n/about): if h == 5 and b == 3 or (h == 3 and b == 5):
") .lower().strip() print("Spock smashed the scissors!")
if var1 == "y": print("------------------------------")
while True:
#6
print("What would you like to pick, type the appropriate integer?") if h == 3 and b == 4 or (h == 4 and b == 3):
h = int(input(" 1. Rock \n 2. Paper \n 3. Scissors \n 4. Lizard \n 5. Spock: ")) print("Scissors Decapitates lizard!")
# rps - ls print("---------------------------------------")
b = random. randint(1, 5)
#8
print("Your opponent has picked:", b) if h == 4 and b == 2 or (h == 2 and b == 4):
#1 print("Lizard eats Paper!")
if h == 3 and b == 2 or (h == 2 and b == 3): print("----------------------------")
print("Scissors cut paper!")
print("----------------------") #9
if h == 2 and b == 5 or (h == 5 and b == 2):
print("Paper disproves spock!")
#2 print("--------------------------")
if h == 2 and b == 1 or (h == 1 and b == 2):
print("Paper covers rock!") #10
if h == 5 and b == 1 or (h == 1 and b == 5):
print("--------------------") print("Spock vaporises rock!")
print("-------------------------")
#3
if h == 1 and b == 4 or (h == 4 and b == 1): #11
print("Rock covers lizard!") if h == 1 and b == 3 or (h == 3 and b == 1):
print("Rock crushes scissors!")
print("----------------------") print("-------------------------")
#12
if h == b:
print("It's a draw!")
print("---------------")
#13
if h > 5 or h < 1:
print("Answer is above or below number of options.")
print("---------------------------------------------")
ORIGINAL CODE CONTINUED
elif var1 == "about":
print("Rock Paper Scissors Lizard Spock (or RSPLS) is a modified game of the original "
"Rock Paper Scissors (or RPS).\nIt was modified to lower amount of draws by adding"
" more options.\n'Spock,' is a Star Trek reference and 'lizard,' was added by the original creator"
" Sam Kass. -Sheldon and Sam Kass.\n------------------------------------------------------------------"
"----------------------------------------------------")
#1 ,2 ,3 ,4 ,5
#"Scissors cuts paper, paper covers rock, rock crushed lizard, lizard poisons Spock, Spock smashes scissors,
#6 ,7 ,8 ,9 , 10
# scissors decapitates lizard, lizard eats paper, paper disproves Spock, Spock vaporizes rock, and as it always has,
# 11.
# rock crushes scissors." -Sheldon and Sam Kass
PSEUDOCODE
#5
om module Pseudocode: if h is 5 and b is 3 or if condition on left are not met, try right (h is 3 and b
display("Spock smashed the scissors!")
display("------------------------------")
low is variable
splay question and then ask for input from user("Do you want to play, or find out why there are more options? (y/n/about): ") .decapitlalize().removespaces()
#6
e)1 is "y":
if h is 3 and b is 4 or if conditions on left are not met, try right (h is 4 and b
s True, or forever loop:
display("The scissors decapitated the lizard!")
lay("What would you like to pick, type the appropriate integer?")
display("---------------------------------------")
number user input only(take input from user(" 1. Rock \n 2. Paper \n 3. Scissors \n 4. Lizard \n 5. Spock: "))
s - ls
#7
random from set of options. random number between specified range on right(1, 5)
if h is 4 and b is 2 or if conditions on left are not met, try right (h is 2 and b
lay("Your opponent has picked:", variable b)
display("Scissors decapitates lizard!")
display("-----------------------------")
s 3 and b is 2 or if conditions on left are not met, try right (h is 2 and b is 3) if all conditions are met:
splay("Scissors cut paper!")
#8
splay("----------------------")
if h is 4 and b is 2 or if condition on left are not met, try right (h is 2 and b
display("Lizard eats Paper!")
display("----------------------------")
s 2 and b is 1 or if condition on left are not met, try right (h is 1 and b is 2):
splay("Paper covers rock!")
#9
splay("--------------------")
if h is 2 and b is 5 or if condition on left are not met, try right (h is 5 and b
display("Paper disproves spock!")
display("--------------------------")
s 1 and b is 4 or if conditions on left are not met, try right (h is 4 and b is 1):
splay("Rock covers lizard!")
#10
splay("----------------------")
if h is 5 and b is 1 or if condition on left are not met, try right (h is 1 and b
display("Spock vaporises rock!")
display("-------------------------")
s 4 and b is 5 or if condition on left are not met, try right (h is 5 and b is 4):
splay("Lizard poisoned spock!")
#11
splay("------------------------")
if h is 1 and b is 3 or if condition on left are not met, try right (h is 3 and b
display("Rock crushes scissors!")
display("-------------------------")
PSEUDOCODE CONTINUED
#12
if h is b and conditions are met:
display("It's a draw!")
display("---------------")
#13
if h is larger than 5 or h is smaller than 1:
display("Answer is above or below number of options.")
display("---------------------------------------------")
if the previous condition was not true then try this condition var1 == "about":
print("Rock Paper Scissors Lizard Spock (or RSPLS) is a modified game of the original "
"Rock Paper Scissors (or RPS).\newlineIt was modified to lower amount of draws by adding"
" more options.\newline'Spock,' is a Star Trek reference and 'lizard,' was added by the original creator"
" Sam Kass. -Sheldon and Sam Kass.\newline------------------------------------------------------------------"
"----------------------------------------------------")
if the previous condition was not true then try this one var1 == "n":
display("Very well, the program will close now.")
terminatepythonterminal()
if all other conditions are not met then do this anyways:
display("You have entered an invalid answer, closing the game.")
#1 ,2 ,3 ,4 ,5
#"Scissors cuts paper, paper covers rock, rock crushed lizard, lizard poisons Spock, Spock smashes scissors,
#6 ,7 ,8 ,9 , 10
# scissors decapitates lizard, lizard eats paper, paper disproves Spock, Spock vaporizes rock, and as it always has,
# 11.
# rock crushes scissors." -Sheldon and Sam Kass