Last active
September 28, 2018 14:43
-
-
Save XChrisUnknownX/19d41278eae32c167a8b49dafb8f7b01 to your computer and use it in GitHub Desktop.
Rock Paper Cheater.py
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
import time | |
import random | |
#This is almost exactly the same code as Ultimate Rock Paper Scissor but it cheats so that the player can never win. | |
game1 = "game1" | |
game2 = "game2" | |
game3 = "game3" | |
game4 = "game4" | |
game5 = "game5" | |
game6 = "game6" | |
game7 = "game7" | |
game8 = "game8" | |
game9 = "game9" | |
game10 = "game10" | |
game11 = "game11" | |
game12 ="game12" | |
game13 ="game13" | |
game14 = "game14" | |
games = [game1,game2,game3,game4,game5,game6,game7,game8,game9,game10,game11,game12,game13,game14] | |
#put to game 14 | |
wildcard = "wild" | |
bravery = "brave" | |
spite = "spite" | |
strength = "strength" | |
wildchoice = [bravery,spite,strength] | |
#need to make input overwrite game. | |
gamenum = -1 | |
pwon = 0 | |
cwon = 0 | |
rock = "rock" | |
paper = "paper" | |
scissor = "scissor" | |
lazarus = "lazarus" | |
three = [rock,paper,scissor] | |
four = [rock,paper,scissor,lazarus,lazarus,lazarus] | |
rp = [rock,paper] | |
ps = [paper,scissor] | |
rs = [rock,scissor] | |
threepapers = [scissor,scissor,rock,paper,paper] | |
threerocks = [paper,paper,rock,rock,scissor] | |
threescissors = [rock,rock,scissor,scissor,paper] | |
space = " " | |
startmessage = "Type rock, paper, or scissor." | |
pwons = str(pwon) | |
cwons = str(cwon) | |
scoreboard = """You have won """ + pwons + space + """games | |
Computer has won """ + cwons + """ games. | |
""" | |
print("First to seven wins!") | |
print() | |
while True: | |
pwons = str(pwon) | |
cwons = str(cwon) | |
if pwon == 1: | |
game = "game." | |
else: | |
game = "games." | |
if cwon == 1: | |
cgame = "game." | |
else: | |
cgame = "games." | |
scoreboard = """You have won """ + pwons + space + game + """ | |
Computer has won """ + cwons + space + cgame + """ | |
""" | |
if pwon >= 7: | |
print("You win! Play again!") | |
print() | |
pwon = 0 | |
cwon = 0 | |
gamenum = -1 | |
games = [game1,game2,game3,game4,game5,game6,game7,game8,game9,game10,game11,game12,game13,game14] | |
continue | |
elif cwon >= 7: | |
print("Computer wins! Try again!") | |
print() | |
pwon = 0 | |
cwon = 0 | |
gamenum = -1 | |
games = [game1,game2,game3,game4,game5,game6,game7,game8,game9,game10,game11,game12,game13,game14] | |
continue | |
else: | |
pass | |
print(scoreboard) | |
time.sleep(2) | |
print(startmessage) | |
print() | |
pwons = str(pwon) | |
cwons = str(cwon) | |
pick = input() | |
time.sleep(.5) | |
print() | |
if pick == rock or pick == paper or pick == scissor: | |
pass | |
else: | |
print("Must type rock, paper, or scissor. No caps or punctuation.") | |
continue | |
jolly = pwon - cwon | |
if jolly >= 2: | |
if pick == rock: | |
cpick = random.choice(ps) | |
elif pick == paper: | |
cpick = random.choice(rs) | |
elif pick == scissor: | |
cpick = random.choice(rp) | |
elif jolly <= -2: | |
cpick = random.choice(four) | |
else: | |
cpick = random.choice(three) | |
wildcard = random.choice([True,False,False,False,False,False,False,False,False,False]) | |
if wildcard == True: | |
card = random.choice([wildchoice]) | |
wildchoice.append(card) | |
if card == bravery: | |
cpick = random.choice([paper,paper,rock,scissor]) | |
elif card == spite: | |
cpick = random.choice([scissor,scissor,paper,rock]) | |
elif card == strength: | |
cpick = random.choice([rock,rock,paper,scissor]) | |
else: | |
pass | |
#there was to be many branching patterns to detect if the player was playing a certain way and weight the computer's choices but I became relatively uninspired and left it undone. | |
gamenum += 1 | |
games[gamenum] = pick | |
if games[0] == rock and games[1] == rock and games[2] == rock: | |
cpick = random.choice([paper,paper,paper,rock,scissor]) | |
games[1] = game1 | |
elif games[0] == paper and games[1] == paper and games[2] == paper: | |
cpick = random.choice([scissor,scissor,scissor,rock,paper]) | |
games[1] = game1 | |
elif games[0] == scissor and games[1] == scissor and games[2] == scissor: | |
cpick = random.choice([rock,rock,rock,scissor,paper]) | |
games[1] = game1 | |
else: | |
pass | |
#put game stuff here | |
#IF GAME | |
#this is where i insert the code for rock paper cheater. | |
if pick == rock: | |
cpick = paper | |
elif pick == paper: | |
cpick = scissor | |
elif pick == scissor: | |
cpick = rock | |
else: | |
pass | |
#the above code ensures the player can never win. | |
if pick == rock and cpick == rock: | |
print("Tied with rock.") | |
elif pick == rock and cpick == paper: | |
print("Computer chose paper. Computer wins.") | |
cwon += 1 | |
elif pick == rock and cpick == scissor: | |
print("Computer chose scissor. You win.") | |
pwon += 1 | |
elif pick == paper and cpick == paper: | |
print("Tied with paper.") | |
elif pick == paper and cpick == rock: | |
print("Computer chose rock. You win.") | |
pwon += 1 | |
elif pick == paper and cpick == scissor: | |
print("Computer chose scissor. Computer wins.") | |
cwon += 1 | |
elif pick == scissor and cpick == scissor: | |
print("Tied with scissor.") | |
elif pick == scissor and cpick == paper: | |
print("Computer chose paper. You win.") | |
pwon += 1 | |
elif pick == scissor and cpick == rock: | |
print("Computer chose rock. Computer wins.") | |
cwon += 1 | |
elif pick == rock and cpick == lazarus: | |
print("Computer chose scissor. You win.") | |
pwon += 1 | |
elif pick == scissor and cpick == lazarus: | |
print("Computer chose paper. You win.") | |
pwon += 1 | |
elif pick == paper and cpick == lazarus: | |
print("Computee chose rock. You win.") | |
pwon += 1 | |
print() | |
time.sleep(1.5) | |
continue | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment