Text Size
Text Size
Exit Full Screen
Python Mini
Show
Source Code
View Source Code in Full Screen
Open in New Tab
import random import time gameInProgress = True while gameInProgress: moves = ["rock", "paper", "scissors", "lizard", "spock"] yourMove = raw_input("Make your move! Choose 'Rock', 'Paper', 'Scissors', 'Lizard' or 'Spock'!!!") yourMove = yourMove.lower() compMove = random.choice(moves) time.sleep(1) print "Rock, paper, scissors, lizard, spock! SHOOT!!!" time.sleep(1) print "Your move: %s!" % (yourMove) print "Your opponent's move: %s!" % (compMove) time.sleep(2) #if it is a tie... if yourMove == "spock" and compMove == "spock": print "Spock dueling Spock??? RAYGUN BATTLE!!!" time.sleep(0.5) print "PEW! PEW! PEW!" time.sleep(1) print "Awww, stalemate!!!" break elif yourMove == compMove: print "Awww, stalemate!!!" break #if you picked rock... elif yourMove == "rock" and compMove == "paper": print "Your rock got eaten by opponent's paper!" time.sleep(1) print "You got Defeated!" break elif yourMove == "rock" and compMove == "scissors": print "Your rock shattered opponent's scissors!" time.sleep(1) print "You achieved Victory!!!" break elif yourMove == "rock" and compMove == "lizard": print "Your rock squashed opponent's lizard!" time.sleep(1) print "You achieved Victory!!!" break elif yourMove == "rock" and compMove == "spock": print "Your rock got vaporized by opponent's Spock!" time.sleep(1) print "You got Defeated!!!" break #if you picked paper... elif yourMove == "paper" and compMove == "rock": print "Your paper ate opponent's rock!" time.sleep(1) print "You achieved Victory!!!" break elif yourMove == "paper" and compMove == "scissors": print "Your paper got slashed to bits by opponent's scissors!" time.sleep(1) print "You got Defeated!!!" break elif yourMove == "paper" and compMove == "lizard": print "Your paper has became opponent's lizard's breakfast!" time.sleep(1) print "You got Defeated!!!" break elif yourMove == "paper" and compMove == "spock": print "Your paper disproved opponent's Spock!" time.sleep(1) print "You achieved Victory!!!" break #if you picked scissors elif yourMove == "scissors" and compMove == "rock": print "Your scissors got shattered by opponent's rock!" time.sleep(1) print "You got Defeated!" break elif yourMove == "scissors" and compMove == "paper": print "Your scissors shredded opponent's paper to bits!" time.sleep(1) print "You achieved Victory!!!" break elif yourMove == "scissors" and compMove == "lizard": print "Your scissors sliced off opponent's lizard's head!" time.sleep(1) print "You achieved Victory!!!" break elif yourMove == "scissors" and compMove == "spock": print "Your scissors got smashed by opponent's Spock!" time.sleep(1) print "You got Defeated!!!" break #if you picked lizard elif yourMove == "lizard" and compMove == "rock": print "Your lizard got squished by opponent's rock!" time.sleep(1) print "You got Defeated!!!" break elif yourMove == "lizard" and compMove == "paper": print "Your lizard made a meal of opponent's paper!" time.sleep(1) print "You achieved Victory!!!" break elif yourMove == "lizard" and compMove == "scissors": print "Your lizard's head got sliced off by opponent's scissors!" time.sleep(1) print "You got Defeated!!!" break elif yourMove == "lizard" and compMove == "spock": print "Your lizard bit and poisoned opponent's Spock!" time.sleep(1) print "You achieved Victory!!!" break #if you picked Spock elif yourMove == "spock" and compMove == "rock": print "Your Spock vaporized opponent's rock!" time.sleep(1) print "You achieved Victory!!!" break elif yourMove == "spock" and compMove == "paper": print "Your Spock got invalidated by opponent's paper!" time.sleep(1) print "You got Defeated!!!" break elif yourMove == "spock" and compMove == "scissors": print "Your Spock shattered opponent's scissors!" time.sleep(1) print "You achieved Victory!!!" break elif yourMove == "spock" and compMove == "lizard": print "Your Spock got bitten and injected with venom by opponent's lizard!" time.sleep(1) print "You got Defeated!!!" break else: print "Invalid move! It must be either Rock, Paper, Scissors, Lizard or Spock!" time.sleep(1) print "Try again!!!" print "" time.sleep(2) continue
ch_RPS_plus_LizSpok.py
( around 137 lines python code )
Published By:
EM5700
Published on
2019-10-03T12:51:30Z
Python Mini
- an
OYOclass
application,
own your own class today
.
Run
Result
×
Error message shows here