Guest User

Untitled

a guest
Mar 11th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.74 KB | None | 0 0
  1. Did some tinkering with goodies code then I found another code to learn from:
  2. --------------------------------------------------------------------------------
  3. [php]
  4. #!/usr/bin/env python
  5. # -*-coding:utf-8-*-
  6. import time
  7. from time import sleep
  8. import random
  9.  
  10. sus="-"*35
  11. depo=["rock","paper","scissors","lizard","spock"]
  12. while True:
  13. x=input("rock, paper, scissors: ")
  14. if x not in depo:
  15. print ("Don't cheat!")
  16. continue
  17.  
  18. pc=random.choice(depo)
  19. sleep(0.5)
  20. print (("Computer picked {}.").format(pc))
  21. if x==pc:
  22. sleep(0.5)
  23. print (("\nIt's a draw.\n{}").format(sus))
  24. elif x=="rock" and pc=="scissors":
  25. sleep(0.5)
  26. print (("\nYou win.rock beats scissors\n{}").format(sus))
  27. elif x=="rock" and pc=="paper":
  28. sleep(0.5)
  29. print (("\nYou lose.paper beats rock\n{}").format(sus))
  30. elif x=="paper" and pc=="rock":
  31. sleep(0.5)
  32. print (("\nYou win.paper beats rock\n{}").format(sus))
  33. elif x=="paper" and pc=="scissors":
  34. sleep(0.5)
  35. print (("\nYou lose.scissors beats paper\n{}").format(sus))
  36. elif x=="scissors" and pc=="paper":
  37. sleep(0.5)
  38. print (("\nYou win.scissors beats paper\n{}").format(sus))
  39. elif x=="scissors" and pc=="rock":
  40. sleep(0.5)
  41. print (("\nYou lose.rock beats scissors\n{}").format(sus))
  42.  
  43. else:
  44. sleep(0.5)
  45. print (("\nYou lose. {} beats {}\n{}").format(pc,x,sus))
  46. input()
  47.  
  48. [/php]
  49.  
  50. --------------------------------------------------------------------------
  51. Made alot of modifications and made this...
  52. --------------------------------------------------------------------------
  53.  
  54. [php]
  55.  
  56. import os, time
  57. from time import sleep
  58. import random
  59. def cls():
  60. if os.name == 'nt':
  61. os.system('cls')
  62. else:
  63. os.system("clear")
  64.  
  65.  
  66. sus="-"*35
  67. depo=["rock","paper","scissors","lizard","spock"]
  68. while True:
  69. x=input("rock, paper, scissors, lizard, or spock: ")
  70. cls()
  71. if x not in depo:
  72. print ("Make a Decision!")
  73. continue
  74.  
  75.  
  76. pc=random.choice(depo)
  77. sleep(0.5)
  78. print (("Computer picked {}.").format(pc))
  79. if x==pc:
  80. sleep(0.5)
  81. print (("\nIt's a draw.\n{}").format(sus))
  82. input("Try Again? Press Enter to Continue... ")
  83. cls()
  84.  
  85.  
  86. elif x=="rock" and pc=="scissors":
  87. sleep(0.5)
  88. print (("\nYOU WIN! Rock smashes scissors.\n{}").format(sus))
  89. input("Try Again? Press Enter to Continue... ")
  90. cls()
  91. elif x=="rock" and pc=="spock":
  92. sleep(0.5)
  93. print (("\nYOU LOSE! Spock vaporizes rock.\n{}").format(sus))
  94. input("Try Again? Press Enter to Continue... ")
  95. cls()
  96. elif x=="rock" and pc=="lizard":
  97. sleep(0.5)
  98. print (("\nYOU WIN! Rock crushes lizard.\n{}").format(sus))
  99. input("Try Again? Press Enter to Continue... ")
  100. cls()
  101. elif x=="rock" and pc=="paper":
  102. sleep(0.5)
  103. print (("\nYOU LOSE! Paper covers rock.\n{}").format(sus))
  104. input("Try Again? Press Enter to Continue... ")
  105. cls()
  106.  
  107.  
  108. elif x=="paper" and pc=="rock":
  109. sleep(0.5)
  110. print (("\nYOU WIN! Paper beats rock,\n{}").format(sus))
  111. input("Try Again? Press Enter to Continue... ")
  112. cls()
  113. elif x=="paper" and pc=="scissors":
  114. sleep(0.5)
  115. print (("\nYOU LOSE! Scissors cut paper\n{}").format(sus))
  116. input("Try Again? Press Enter to Continue... ")
  117. cls()
  118. elif x=="paper" and pc=="spock":
  119. sleep(0.5)
  120. print (("\nYOU WIN! Paper dispoves Spock.\n{}").format(sus))
  121. input("Try Again? Press Enter to Continue... ")
  122. cls()
  123. elif x=="paper" and pc=="lizard":
  124. sleep(0.5)
  125. print (("\nYOU LOSE! Lizard eats paper.\n{}").format(sus))
  126. input("Try Again? Press Enter to Continue... ")
  127. cls()
  128.  
  129.  
  130. elif x=="scissors" and pc=="paper":
  131. sleep(0.5)
  132. print (("\nYOU WIN! Scissors cuts paper.\n{}").format(sus))
  133. input("Try Again? Press Enter to Continue... ")
  134. cls()
  135. elif x=="scissors" and pc=="lizard":
  136. sleep(0.5)
  137. print (("\nYOU WIN! Scissors decapitates liazrd.\n{}").format(sus))
  138. input("Try Again? Press Enter to Continue... ")
  139. cls()
  140. elif x=="scissors" and pc=="spock":
  141. sleep(0.5)
  142. print (("\nYOU LOSE!Spock smashes scissors.\n{}").format(sus))
  143. input("Try Again? Press Enter to Continue... ")
  144. cls()
  145. elif x=="scissors" and pc=="rock":
  146. sleep(0.5)
  147. print (("\nYOU LOSE! Rock smashes scissors.\n{}").format(sus))
  148. input("Try Again? Press Enter to Continue... ")
  149. cls()
  150.  
  151.  
  152. elif x=="lizard" and pc=="paper":
  153. sleep(0.5)
  154. print (("\nYOU WIN! Lizard eats paper.\n{}").format(sus))
  155. input("Try Again? Press Enter to Continue... ")
  156. cls()
  157. elif x=="lizard" and pc=="rock":
  158. sleep(0.5)
  159. print (("\nYOU LOSE! Rock crushes lizard.\n{}").format(sus))
  160. input("Try Again? Press Enter to Continue... ")
  161. cls()
  162. elif x=="lizard" and pc=="spock":
  163. sleep(0.5)
  164. print (("\nYOU WIN! Lizard poisons Spock.\n{}").format(sus))
  165. input("Try Again? Press Enter to Continue... ")
  166. cls()
  167. elif x=="lizard" and pc=="scissors":
  168. sleep(0.5)
  169. print (("\nYOU LOSE! Scissors decapitates lizard.\n{}").format(sus))
  170. input("Try Again? Press Enter to Continue... ")
  171. cls()
  172.  
  173.  
  174. elif x=="spock" and pc=="paper":
  175. sleep(0.5)
  176. print (("\nYOU LOSE! Paper disproves Spock.\n{}").format(sus))
  177. input("Try Again? Press Enter to Continue... ")
  178. cls()
  179. elif x=="spock" and pc=="scissors":
  180. sleep(0.5)
  181. print (("\nYOU WIN! Spock smashes scissors.\n{}").format(sus))
  182. input("Try Again? Press Enter to Continue... ")
  183. cls()
  184. elif x=="spock" and pc=="lizard":
  185. sleep(0.5)
  186. print (("\nYOU LOSE! Lizard poisons Spock.\n{}").format(sus))
  187. input("Try Again? Press Enter to Continue... ")
  188. cls()
  189. elif x=="spock" and pc=="rock":
  190. sleep(0.5)
  191. print (("\nYOU WIN! Spock vaporizes rock.\n{}").format(sus))
  192. input("Try Again? Press Enter to Continue... ")
  193. cls()
  194.  
  195.  
  196. else:
  197. sleep(0.5)
  198. print (("\nYOU LOSE! {} beats {}\n{}").format(pc,x,sus))
  199. input("Try Again? Press Enter to Continue... ")
  200. cls()
  201. input()
  202.  
  203. [/php]
  204.  
  205. 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