Advertisement
robbinsjspp

CP1 Python Quarterly

Apr 7th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.05 KB | None | 0 0
  1. #!/usr/bin/python
  2. import string
  3. import math
  4. import random
  5. import time
  6. # this is the boot up sequence for the computer
  7. # this sequence was made by chris
  8. # everything else was made James
  9. def bootup():
  10. print "-" * 56
  11. print " Welcome!"
  12. print " Starting up Computer!"
  13.  
  14. waiting = " waiting..."
  15. print " "
  16. print waiting
  17. time.sleep(0.5)
  18. print waiting
  19. time.sleep(0.5)
  20. print waiting
  21. time.sleep(0.5)
  22. print " "
  23. print " Keyboard Found!"
  24. time.sleep(1)
  25. print " Mouse Found!"
  26. time.sleep(1)
  27. print " Hard drive Found!"
  28. time.sleep(1)
  29. print " Monitor Found!"
  30. time.sleep(1)
  31. print " GPU Found!"
  32. time.sleep(1)
  33. print " CPU Found!"
  34. time.sleep(1)
  35. print " "
  36. print " Starting Login Screen!"
  37. bootup()
  38. # this is the username and password setup for the computer
  39. def userpassword():
  40. print "-" * 56
  41. print "Hello!"
  42. print " "
  43. print "Please insert username:"
  44. username = raw_input()
  45. password = raw_input("Please insert password:(Hint: What year is it?)")
  46. if password == "2016":
  47. print "Continuing login process..."
  48. if password != "2016":
  49. print "Sorry, but that is incorrect! System shutting down! Please reboot computer!"
  50. exit(0)
  51. userpassword()
  52. time.sleep(1)
  53. def programs():
  54. time.sleep(1)
  55. print " Welcome!"
  56. time.sleep(1)
  57. print " Here are a list of programs for you to run:"
  58. print " 1. Google Chrome"
  59. print " 2. Happy Leify"
  60. print " 3. Mozilla Firefox"
  61. print " 4. System Check"
  62. print " 5. Log Off"
  63. print " 6. Shut Down Computer"
  64. prg = int(raw_input("Please input the number of the program you want to run: "))
  65. if prg == 1:
  66. print "Opening Google Chrome..."
  67. time.sleep(1)
  68. print "Oops! No WiFi. Sorry, but Saint Peter's WiFi is terrible. Can't open."
  69. time.sleep(1)
  70. programs()
  71. elif prg == 2:
  72. print "-" * 30
  73. print " H A P P Y L E I F Y "
  74. print "-" * 30
  75. print " "
  76. print " 1. Play Game"
  77. print " 2. View Credits"
  78. print " 3. Smoke W33d Evrydae"
  79. print " 4. MLG"
  80. print "-" * 30
  81. print " "
  82. number = raw_input("Input a number: ")
  83. number = int(number)
  84. if number == 1:
  85. print "Welcome Leif Ericson. Oh, you don't remember? You are the great son of the Red Ericson. You're supposed to be on an adventure, right?\nWell, anywho, you're walking on a trail and come up at a fork in the road. Oh, and there is a fork in the road. You can either turn left or right."
  86. direction = raw_input("Which way will you go?")
  87. if direction == "left":
  88. print "Okay, you take the left path. You come up on a cliff. There is a ladder going up to the top of a cliff. You also notice a cave with a sign stating 'Rainbows and Unicorns Inside!' So there are your choices: either a ladder or a cave."
  89. direction2 = raw_input("Which way will you go again? (Type ladder or cave)")
  90. if direction2 == "ladder":
  91. print "You start climbing up the ladder. When you get to the top, you spot a slide going down back the path. You take the slide down and get back onto the path. As you walk down the path, you manage to find a beach with a bunch of mermaids. Congratz you win!"
  92. time.sleep(1)
  93. print "Sending you back to the main menu..."
  94. time.sleep(1)
  95. programs()
  96. elif direction2 == "cave":
  97. print "Wow! You are really gullible! Did you actually think there were unicorns and rainbows?! Wow... Anywho, you walk in the cave of a pack of lions and get eaten alive. The End. Being gullible loses every game. Please try the game over."
  98. time.sleep(1)
  99. print "Sending you back to the main menu..."
  100. time.sleep(1)
  101. programs()
  102. elif direction == "right":
  103. print "Way to go! You walk straight into a sand pit. For a fierce viking, you're pretty dumb. Please try the game over."
  104. time.sleep(1)
  105. print "Sending you back to the main menu..."
  106. time.sleep(1)
  107. programs()
  108. elif number == 2:
  109. print "Game was made by James Robbins and Nick Demetriades. (And was trash.)"
  110. time.sleep(1)
  111. print "Sending you back to the main menu..."
  112. time.sleep(1)
  113. programs()
  114. elif number == 3:
  115. print "Snoop Dogg: 'Smoke Weed everyday'"
  116. time.sleep(1)
  117. print "Sending you back to the main menu..."
  118. time.sleep(1)
  119. programs()
  120. elif number == 4:
  121. print "DUN DUNDUNDUNDUN DUN"
  122. time.sleep(1)
  123. print "Sending you back to the main menu..."
  124. time.sleep(1)
  125. programs()
  126. else:
  127. print "You suck."
  128. time.sleep(1)
  129. print "Sending you back to the main menu..."
  130. time.sleep(1)
  131. programs()
  132. elif prg == 3:
  133. print "Launching Mozilla Firefox"
  134. time.sleep(1)
  135. print "Failure to start Mozilla Firefox. Use a better browser."
  136. programs()
  137. elif prg == 4:
  138. def systemcheck():
  139. print " "
  140. print " Welcome to System Check!"
  141. print " Currently, your CPU only 6% of its potential."
  142. print " And your disk is only running at 37%."
  143. print " Would like to close any programs?"
  144. print " 1. Google Chrome"
  145. print " 2. Happy Leify"
  146. print " 3. Mozilla Firefox"
  147. print " If you don't want to just type no."
  148. systemcheckr = raw_input()
  149. if systemcheckr == "1":
  150. print "Closing up Google Chrome..."
  151. print "Thank you!"
  152. programs()
  153. elif systemcheckr == "2":
  154. print "Closing up Happy Leify..."
  155. print "Thank you!"
  156. programs()
  157. elif systemcheckr == "3":
  158. print "Closing up Mozilla Firefox..."
  159. print "Thank you!"
  160. programs()
  161. elif systemcheckr == "No" or "no":
  162. print "Okay, thank you!"
  163. programs()
  164. systemcheck()
  165. elif prg == 5:
  166. print "Logging off..."
  167. time.sleep(1)
  168. userpassword()
  169. programs()
  170. elif prg == 6:
  171. time.sleep(1)
  172. print "Shutting down computer..."
  173. time.sleep(1)
  174. print "Powering off in:"
  175. count = 0
  176. while (count < 6):
  177. print count
  178. time.sleep(1)
  179. count = count + 1
  180. print "Goodnight!"
  181. exit(0)
  182. programs()
  183.  
  184. #This is my code for the Quarterly. What this program does is that it runs a simplistic
  185. #computer system, using only 6 programs, two of them acting as nothing. For the boot up, I
  186. #used a function called bootup that just stated that the computer was starting and
  187. #had found all the hardware necessary for the computer. I also imported a time module,
  188. #which I had learned from https://docs.python.org/2/library/time.html . The only time
  189. #command I used was the time.sleep, which the suspended the code for a given amount of
  190. #seconds. After the bootup, I used a function named userpassword specified for the
  191. #username and password. I made the username be anything, but the password had to be 2016,
  192. #because if not the code would go through an exit(0) and you would have to restart.
  193.  
  194. #Following up on the programs function, I made a function specified for 6 programs: two
  195. #browsers, one game, and three settings. The browsers wouldn't run anything important
  196. #rather they would say they can't open and just return you to the main menu. The game was
  197. #from an earlier code i used a while back, and instead of going through an exit again, I
  198. #made it so you were returned to the main menu. For the settings, the system check acted
  199. #as a task manager would do on Windows 10 by informing the info of the CPU and Disk,
  200. #but also be allowed to terminate any programs. So, after you could terminate the programs,
  201. #you were returned back to the menu. The log off would send you back to the userpassword
  202. # function. The shut down program would just go to a exit command.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement