Created
May 29, 2016 18:45
-
-
Save Frankenmint/259e657b0804135583d8c96c6e95de93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from time import sleep | |
import random | |
lives = 3 | |
score = 0 | |
def inflate(toStretch): | |
if toStretch == "r": | |
return "Rock" | |
elif toStretch == "p": | |
return "Paper" | |
elif toStretch == "s": | |
return "Scissors" | |
elif toStretch == "l": | |
return "Lizard" | |
elif toStretch == "o": | |
return "Spock" | |
def nextRound(): | |
global lives | |
global score | |
if lives == 0: | |
print "Game Over..." | |
print "your final score is %s" % str(score) | |
raise SystemExit | |
print "Lives remaining: " + str(lives) | |
print "Current Score: " + str(score) | |
myThrow = raw_input("Pick (R)ock (P)aper (S)cissors (L)izard or Sp(O)ck or (H)elp:") | |
if myThrow.lower() == "h": | |
rules() | |
nextRound() | |
elif myThrow.lower() not in ['r', 'p', 's', 'l', 'o', 'h']: | |
print "Please enter a Valid Throw or Press h for the Rules" | |
nextRound() | |
else: | |
cpuThrow = random.randint(1, 5) | |
if cpuThrow == 1: | |
cpuThrow ="r" | |
elif cpuThrow == 2: | |
cpuThrow = "p" | |
elif cpuThrow == 3: | |
cpuThrow = "s" | |
elif cpuThrow == 4: | |
cpuThrow = "l" | |
elif cpuThrow == 5: | |
cpuThrow = "o" | |
if cpuThrow == myThrow: | |
myThrow = inflate(myThrow) | |
print "Computer also threw %s" % myThrow | |
nextRound() | |
elif cpuThrow == 's' and myThrow =='p': | |
print "Cpu Scissors cut your Paper" | |
lives -= 1 | |
nextRound() | |
elif cpuThrow == 'p' and myThrow =='r': | |
print "Cpu Paper cover's your Rock" | |
lives -= 1 | |
nextRound() | |
elif cpuThrow == 'r' and myThrow =='l': | |
print "Cpu Rock crushes your Lizard" | |
lives -= 1 | |
nextRound() | |
elif cpuThrow == 'l' and myThrow =='o': | |
print "Cpu Lizard's poisons your Spock" | |
lives -= 1 | |
nextRound() | |
elif cpuThrow == 'o' and myThrow =='s': | |
print "Cpu Spock smashes your Scissors" | |
lives -= 1 | |
nextRound() | |
elif cpuThrow == 's' and myThrow =='l': | |
print "Cpu Scissors decapitate your Lizard" | |
lives -= 1 | |
nextRound() | |
elif cpuThrow == 'l' and myThrow =='p': | |
print "Cpu Lizard eats your Paper" | |
lives -= 1 | |
nextRound() | |
elif cpuThrow == 'p' and myThrow =='o': | |
print "Cpu Paper disproves your Spock" | |
lives -= 1 | |
nextRound() | |
elif cpuThrow == 'o' and myThrow =='r': | |
print "Cpu Spock vaporizes your Rock" | |
lives -= 1 | |
nextRound() | |
elif cpuThrow == 'r' and myThrow =='s': | |
print "Cpu Rock crushes your Scissors" | |
lives -= 1 | |
nextRound() | |
else: | |
cpuThrow = inflate(cpuThrow) | |
myThrow = inflate(myThrow) | |
print "Your throw of %s beats CPU throw of %s" % (myThrow, cpuThrow) | |
score += 1 | |
nextRound() | |
def rules(): | |
print "Scissors cuts Paper" | |
sleep(1) | |
print "Paper covers Rock" | |
sleep(1) | |
print "Rock crushes Lizard" | |
sleep(1) | |
print "Lizard poisons Spock" | |
sleep(1) | |
print "Spock smashes Scissors" | |
sleep(1) | |
print "Scissors decapitates Lizard" | |
sleep(1) | |
print "Lizard eats Paper" | |
sleep(1) | |
print "Paper disproves Spock" | |
sleep(1) | |
print "Spock vaporizes Rock" | |
sleep(1) | |
print "(and as it always has) Rock crushes Scissors" | |
nextRound() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment