Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Did some tinkering with goodies code then I found another code to learn from:
- --------------------------------------------------------------------------------
- [php]
- #!/usr/bin/env python
- # -*-coding:utf-8-*-
- import time
- from time import sleep
- import random
- sus="-"*35
- depo=["rock","paper","scissors","lizard","spock"]
- while True:
- x=input("rock, paper, scissors: ")
- if x not in depo:
- print ("Don't cheat!")
- continue
- pc=random.choice(depo)
- sleep(0.5)
- print (("Computer picked {}.").format(pc))
- if x==pc:
- sleep(0.5)
- print (("\nIt's a draw.\n{}").format(sus))
- elif x=="rock" and pc=="scissors":
- sleep(0.5)
- print (("\nYou win.rock beats scissors\n{}").format(sus))
- elif x=="rock" and pc=="paper":
- sleep(0.5)
- print (("\nYou lose.paper beats rock\n{}").format(sus))
- elif x=="paper" and pc=="rock":
- sleep(0.5)
- print (("\nYou win.paper beats rock\n{}").format(sus))
- elif x=="paper" and pc=="scissors":
- sleep(0.5)
- print (("\nYou lose.scissors beats paper\n{}").format(sus))
- elif x=="scissors" and pc=="paper":
- sleep(0.5)
- print (("\nYou win.scissors beats paper\n{}").format(sus))
- elif x=="scissors" and pc=="rock":
- sleep(0.5)
- print (("\nYou lose.rock beats scissors\n{}").format(sus))
- else:
- sleep(0.5)
- print (("\nYou lose. {} beats {}\n{}").format(pc,x,sus))
- input()
- [/php]
- --------------------------------------------------------------------------
- Made alot of modifications and made this...
- --------------------------------------------------------------------------
- [php]
- import os, time
- from time import sleep
- import random
- def cls():
- if os.name == 'nt':
- os.system('cls')
- else:
- os.system("clear")
- sus="-"*35
- depo=["rock","paper","scissors","lizard","spock"]
- while True:
- x=input("rock, paper, scissors, lizard, or spock: ")
- cls()
- if x not in depo:
- print ("Make a Decision!")
- continue
- pc=random.choice(depo)
- sleep(0.5)
- print (("Computer picked {}.").format(pc))
- if x==pc:
- sleep(0.5)
- print (("\nIt's a draw.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="rock" and pc=="scissors":
- sleep(0.5)
- print (("\nYOU WIN! Rock smashes scissors.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="rock" and pc=="spock":
- sleep(0.5)
- print (("\nYOU LOSE! Spock vaporizes rock.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="rock" and pc=="lizard":
- sleep(0.5)
- print (("\nYOU WIN! Rock crushes lizard.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="rock" and pc=="paper":
- sleep(0.5)
- print (("\nYOU LOSE! Paper covers rock.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="paper" and pc=="rock":
- sleep(0.5)
- print (("\nYOU WIN! Paper beats rock,\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="paper" and pc=="scissors":
- sleep(0.5)
- print (("\nYOU LOSE! Scissors cut paper\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="paper" and pc=="spock":
- sleep(0.5)
- print (("\nYOU WIN! Paper dispoves Spock.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="paper" and pc=="lizard":
- sleep(0.5)
- print (("\nYOU LOSE! Lizard eats paper.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="scissors" and pc=="paper":
- sleep(0.5)
- print (("\nYOU WIN! Scissors cuts paper.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="scissors" and pc=="lizard":
- sleep(0.5)
- print (("\nYOU WIN! Scissors decapitates liazrd.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="scissors" and pc=="spock":
- sleep(0.5)
- print (("\nYOU LOSE!Spock smashes scissors.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="scissors" and pc=="rock":
- sleep(0.5)
- print (("\nYOU LOSE! Rock smashes scissors.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="lizard" and pc=="paper":
- sleep(0.5)
- print (("\nYOU WIN! Lizard eats paper.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="lizard" and pc=="rock":
- sleep(0.5)
- print (("\nYOU LOSE! Rock crushes lizard.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="lizard" and pc=="spock":
- sleep(0.5)
- print (("\nYOU WIN! Lizard poisons Spock.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="lizard" and pc=="scissors":
- sleep(0.5)
- print (("\nYOU LOSE! Scissors decapitates lizard.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="spock" and pc=="paper":
- sleep(0.5)
- print (("\nYOU LOSE! Paper disproves Spock.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="spock" and pc=="scissors":
- sleep(0.5)
- print (("\nYOU WIN! Spock smashes scissors.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="spock" and pc=="lizard":
- sleep(0.5)
- print (("\nYOU LOSE! Lizard poisons Spock.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- elif x=="spock" and pc=="rock":
- sleep(0.5)
- print (("\nYOU WIN! Spock vaporizes rock.\n{}").format(sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- else:
- sleep(0.5)
- print (("\nYOU LOSE! {} beats {}\n{}").format(pc,x,sus))
- input("Try Again? Press Enter to Continue... ")
- cls()
- input()
- [/php]
- I really want to make a exit option with this and possibly keep score... also when the computer decides it shows some ascii of a hand doing the option it chooses.
Advertisement
Add Comment
Please, Sign In to add comment