SlideShare a Scribd company logo
1 of 11
Download to read offline
Psuedocode:
//Rachel Joseph
//07/30/16
//This program will play rock paper scissors
main module
//print intro and menu
input selection
if selection 1
seeRules module
elif selection 2
againstCP module
elif selection 3
againstHum module
elif selection 4
quitGame module
else
display "This selection is not valid"
end if
//intro message
introMessage module
display "Welcome to rock, paper, scissors"
//Menu for making a selection on what to do
menu module
display "Select what you want to do"
display "1. see the rules"
display "2. Play against the computer."
display "3. Play against another person."
display "4. Quit"
//replay option
replay module
display "do you want to play again?"
input yes or no
while playAgain.lower = yes
display "Thanks for playing!"
end while
//game rules
seeRules module
display "The rules are as follows:"
display "Paper covers rock"
display "rock smashed scissors"
display "scissors cut paper"
//playing against the computer
againstCP module
import randint
declare q = "rock", "paper", "Scissors"
declare computer = q[randint(0,2)]
declare player = false
while player == false
input "rock, paper, or scissors"
if player == computer
display "Tie"
elif player == rock
if computer == paper
dispaly "you lose"
else:
display "You win"
elif player == paper
if computer == scissors
display "You lose"
else:
display "you win"
elif player == scissors
if computer == rock
display "you lose"
else:
display "you win"
else:
display "Thats not a valid play"
//playing against another human player
againstHum module
declare p1 = input "rock, paper or scissors?"
declare p2 = input "rock, paper or scissors?"
declare choices = rock, paper, scissors
rock = false
paper = false
scissors = false
if p1 == p2
display "Tie"
if p1 == rock
rock = true
if p2 == rock
rock = true
if p1 == paper
paper = true
if p2 == paper
paper = true
if p1 == scissors
scissors = true
if p2 == scissors
scissors = true
if rock and paper
display "paper wins"
if rock and scissors
display "rock wins"
if scissors and paper
display "scissors wins"
if p1 not in choices
display "That is not a valid play"
call againstHum
elif p2 not in choices
display "That is not a valid play"
call againstHum
else:
display "Game over"
//quitting the game
quitGame module
display "Thanks for playing!"
Python Code:
#Rachel Joseph
#07/30/16
#This program will display a menu and allow user to play Rock, Paper, Scissors
def main():
selection = 0
#print intro and menu of options
introMessage()
menu()
#get selection from user
selection = eval(input("Please choose an option: "))
#Begin decision structure
if selection == 1:
seeRules()
elif selection == 2:
againstCP()
elif selection == 3:
againstHum()
elif selection == 4:
quitGame()
print ("Program end")
else: #validate selection
print ("This is not a valid selection, please try againn")
def introMessage():
#Intro message
print ("Welcome to Rock, Paper, Scissors!n")
def menu():
#Menu for user to select what they want to do
print ("Select what you want to do!n")
print ("1. See the rules")
print ("2. Play against the computer")
print ("3. Play a two player game")
print ("4. Quit")
#option to replay the game
def replay():
playAgain = ""
playAgain = input("Do you want to play again, yes or no? ")
while playAgain.lower() != "yes":
print("Thanks for playing!")
#Rules for the game
def seeRules():
print ("The rules are as follows:")
print ("Paper Covers Rock")
print ("Rock Smashed Scissors")
print ("Scissors Cut Paper")
#Rock, paper, scissors against the computer
def againstCP():
from random import randint
q = ["rock", "paper", "scissors"]
computer = q[randint(0,2)]
player = False
while player == False:
player = input("rock, paper, scissors?")
if player == computer:
print("Tie!")
elif player == "rock":
if computer == "paper":
print("You lose.", computer, "covers", player)
else:
print("You win!", player, "smashes", computer)
elif player == "paper":
if computer == "scissors":
print("You lose.", computer, "cut", player)
else:
print("You win!", player, "covers", computer)
elif player == "scissors":
if computer == "rock":
print("You lose.", computer, "smashes", player)
else:
print("You win!", player, "cut", computer)
else:
print("That's not a play!")
player = False
computer = q[randint(0,2)]
#Option 4, quitting the game
def quitGame():
print("Thanks for playing!")
#playing against another human player
def againstHum():
p1 = input("Player 1: Rock, Paper, or Scissors? ")
p2 = input("Player 2: Rock, Paper, or Scissors? ")
choices = ["rock","paper","scissors"]
rock = False
paper = False
scissors = False
if p1==p2:
print ("Tie")
if p1=="rock":
rock=True
if p2=="rock":
rock=True
if p1=="paper":
paper=True
if p2=="paper":
paper=True
if p1=="scissors":
scissors=True
if p2=="scissors":
scissors=True
if rock and paper:
print ("Paper wins")
if rock and scissors:
print ("Rock wins")
if scissors and paper:
print ("Scissors wins")
if p1 not in choices:
print ("Player 1, choose a valid play")
againstHum()
elif p2 not in choices:
print ("Player 2, choose a valid play")
againstHum()
else:
print ("Game over!")
Code Running:
Final Project

More Related Content

Viewers also liked

Análisis del entorno empresa de transportes tax meta
Análisis del entorno empresa de transportes tax metaAnálisis del entorno empresa de transportes tax meta
Análisis del entorno empresa de transportes tax metaAndres Passos Martinez
 
Satin vitrified tiles
Satin vitrified tilesSatin vitrified tiles
Satin vitrified tilesNeel4344
 
2016 VRGAMEJAM チームFOGFOG 成果発表
2016 VRGAMEJAM チームFOGFOG 成果発表2016 VRGAMEJAM チームFOGFOG 成果発表
2016 VRGAMEJAM チームFOGFOG 成果発表toshinori ryu
 
Exploración petrolera copia
Exploración petrolera   copiaExploración petrolera   copia
Exploración petrolera copiaRosy linda
 
mi biografia
mi biografiami biografia
mi biografialion98
 
Investigación de mercados inicial basada en la DB E-PRTR
Investigación de mercados inicial basada en la DB E-PRTRInvestigación de mercados inicial basada en la DB E-PRTR
Investigación de mercados inicial basada en la DB E-PRTRJulián Fernández Ortiz
 
Technologies du web
Technologies du webTechnologies du web
Technologies du webTijanaMilo
 
Divesting Businesses Means Untangling SAP
Divesting Businesses Means Untangling SAPDivesting Businesses Means Untangling SAP
Divesting Businesses Means Untangling SAPGary Niblett
 
Prototype PKM
Prototype PKMPrototype PKM
Prototype PKMLila
 

Viewers also liked (15)

Análisis del entorno empresa de transportes tax meta
Análisis del entorno empresa de transportes tax metaAnálisis del entorno empresa de transportes tax meta
Análisis del entorno empresa de transportes tax meta
 
Khushali paper 4 a
Khushali paper 4 aKhushali paper 4 a
Khushali paper 4 a
 
CV_morvay_2016_11
CV_morvay_2016_11CV_morvay_2016_11
CV_morvay_2016_11
 
Satin vitrified tiles
Satin vitrified tilesSatin vitrified tiles
Satin vitrified tiles
 
Sami y Lili
Sami y Lili Sami y Lili
Sami y Lili
 
Understanding of management
Understanding of managementUnderstanding of management
Understanding of management
 
2016 VRGAMEJAM チームFOGFOG 成果発表
2016 VRGAMEJAM チームFOGFOG 成果発表2016 VRGAMEJAM チームFOGFOG 成果発表
2016 VRGAMEJAM チームFOGFOG 成果発表
 
Exploración petrolera copia
Exploración petrolera   copiaExploración petrolera   copia
Exploración petrolera copia
 
mi biografia
mi biografiami biografia
mi biografia
 
Investigación de mercados inicial basada en la DB E-PRTR
Investigación de mercados inicial basada en la DB E-PRTRInvestigación de mercados inicial basada en la DB E-PRTR
Investigación de mercados inicial basada en la DB E-PRTR
 
Technologies du web
Technologies du webTechnologies du web
Technologies du web
 
Divesting Businesses Means Untangling SAP
Divesting Businesses Means Untangling SAPDivesting Businesses Means Untangling SAP
Divesting Businesses Means Untangling SAP
 
Prototype PKM
Prototype PKMPrototype PKM
Prototype PKM
 
AkosMD Return to Work Solution
AkosMD Return to Work SolutionAkosMD Return to Work Solution
AkosMD Return to Work Solution
 
Leasing
LeasingLeasing
Leasing
 

Final Project

  • 1. Psuedocode: //Rachel Joseph //07/30/16 //This program will play rock paper scissors main module //print intro and menu input selection if selection 1 seeRules module elif selection 2 againstCP module elif selection 3 againstHum module elif selection 4 quitGame module else display "This selection is not valid" end if //intro message introMessage module display "Welcome to rock, paper, scissors" //Menu for making a selection on what to do menu module display "Select what you want to do" display "1. see the rules" display "2. Play against the computer." display "3. Play against another person."
  • 2. display "4. Quit" //replay option replay module display "do you want to play again?" input yes or no while playAgain.lower = yes display "Thanks for playing!" end while //game rules seeRules module display "The rules are as follows:" display "Paper covers rock" display "rock smashed scissors" display "scissors cut paper" //playing against the computer againstCP module import randint declare q = "rock", "paper", "Scissors" declare computer = q[randint(0,2)] declare player = false while player == false input "rock, paper, or scissors" if player == computer display "Tie" elif player == rock
  • 3. if computer == paper dispaly "you lose" else: display "You win" elif player == paper if computer == scissors display "You lose" else: display "you win" elif player == scissors if computer == rock display "you lose" else: display "you win" else: display "Thats not a valid play" //playing against another human player againstHum module declare p1 = input "rock, paper or scissors?" declare p2 = input "rock, paper or scissors?" declare choices = rock, paper, scissors rock = false paper = false scissors = false if p1 == p2 display "Tie" if p1 == rock rock = true
  • 4. if p2 == rock rock = true if p1 == paper paper = true if p2 == paper paper = true if p1 == scissors scissors = true if p2 == scissors scissors = true if rock and paper display "paper wins" if rock and scissors display "rock wins" if scissors and paper display "scissors wins" if p1 not in choices display "That is not a valid play" call againstHum elif p2 not in choices display "That is not a valid play" call againstHum else: display "Game over" //quitting the game quitGame module display "Thanks for playing!"
  • 5. Python Code: #Rachel Joseph #07/30/16 #This program will display a menu and allow user to play Rock, Paper, Scissors def main(): selection = 0 #print intro and menu of options introMessage() menu() #get selection from user selection = eval(input("Please choose an option: ")) #Begin decision structure if selection == 1: seeRules() elif selection == 2: againstCP() elif selection == 3: againstHum() elif selection == 4: quitGame() print ("Program end") else: #validate selection print ("This is not a valid selection, please try againn") def introMessage(): #Intro message print ("Welcome to Rock, Paper, Scissors!n") def menu():
  • 6. #Menu for user to select what they want to do print ("Select what you want to do!n") print ("1. See the rules") print ("2. Play against the computer") print ("3. Play a two player game") print ("4. Quit") #option to replay the game def replay(): playAgain = "" playAgain = input("Do you want to play again, yes or no? ") while playAgain.lower() != "yes": print("Thanks for playing!") #Rules for the game def seeRules(): print ("The rules are as follows:") print ("Paper Covers Rock") print ("Rock Smashed Scissors") print ("Scissors Cut Paper") #Rock, paper, scissors against the computer def againstCP(): from random import randint q = ["rock", "paper", "scissors"] computer = q[randint(0,2)] player = False while player == False:
  • 7. player = input("rock, paper, scissors?") if player == computer: print("Tie!") elif player == "rock": if computer == "paper": print("You lose.", computer, "covers", player) else: print("You win!", player, "smashes", computer) elif player == "paper": if computer == "scissors": print("You lose.", computer, "cut", player) else: print("You win!", player, "covers", computer) elif player == "scissors": if computer == "rock": print("You lose.", computer, "smashes", player) else: print("You win!", player, "cut", computer) else: print("That's not a play!") player = False computer = q[randint(0,2)] #Option 4, quitting the game def quitGame(): print("Thanks for playing!") #playing against another human player def againstHum():
  • 8. p1 = input("Player 1: Rock, Paper, or Scissors? ") p2 = input("Player 2: Rock, Paper, or Scissors? ") choices = ["rock","paper","scissors"] rock = False paper = False scissors = False if p1==p2: print ("Tie") if p1=="rock": rock=True if p2=="rock": rock=True if p1=="paper": paper=True if p2=="paper": paper=True if p1=="scissors": scissors=True if p2=="scissors": scissors=True if rock and paper: print ("Paper wins") if rock and scissors: print ("Rock wins")
  • 9. if scissors and paper: print ("Scissors wins") if p1 not in choices: print ("Player 1, choose a valid play") againstHum() elif p2 not in choices: print ("Player 2, choose a valid play") againstHum() else: print ("Game over!")