Advertisement
Guest User

Project #1 Conor Larkin

a guest
Apr 7th, 2016
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.42 KB | None | 0 0
  1. import random
  2. import math
  3.  
  4. def systemboot(): # checking for inputs
  5. keyboardindex = ["Keyboard check... Keyboard is not present.", "Keyboard check... Keyboard is present."]
  6. keyboard = random.choice(keyboardindex)
  7. mouseindex = ["Mouse check... Mouse is not present.", "Mouse check... Mouse is present."]
  8. mouse = random.choice(mouseindex)
  9. monitorindex = ["Monitor check... Monitor is not present.", "Monitor check... Monitor is present."]
  10. monitor = random.choice(monitorindex)
  11. print keyboard
  12. print mouse
  13. print monitor
  14. if keyboard == keyboardindex[1] and mouse == mouseindex[1] and monitor == monitorindex[1]:
  15. global startup
  16. startup = True
  17. else:
  18. startup = False
  19.  
  20. def stats(): # this runs if all the inputs are in- lists specs like a bios
  21. if startup == True:
  22. print """ This system:
  23. Make: Acer
  24. Model: C720-2844
  25. OS: Nickel OS
  26. CPU: Haswell-Generation Intel Celeron 2955U (Double Core, 2 MB L Cache)
  27. CPU Clock Speed: 1.40 Ghz
  28. Memory: 4 Gb DDR3L
  29. Storage: 16 Gb SSD
  30. GPU: Intel HD (Integrated)
  31. """
  32.  
  33. def badboot(): # this runs if at least one input is not in
  34. if startup == False:
  35. print "Please ensure all inputs and monitor is plugged in and try again."
  36. exit()
  37.  
  38. def login(): # entering username and password
  39. userindex = ["guest", "user", "username"]
  40. passwordindex = ["1234", "password", "SPP"]
  41. user = raw_input("Please input your username.")
  42. if user not in userindex: # incorrect username
  43. print "Invalid username. Initializing automatic security protocols. Shutting down."
  44. exit()
  45. if user in userindex: # correct username
  46. password = raw_input("Please input your password.")
  47. if password not in passwordindex: # incorrect password
  48. print "Invalid Password. Initializing automatic security protocols. Shutting down."
  49. exit()
  50. if password in passwordindex: #correct password
  51. print "Successful login."
  52. global login
  53. login = True
  54.  
  55. def desktop(): # the desktop
  56. print "Hello! Lovely to see you. My name is Stella. I am your personsal assisant. Here in the Nickel OS Alpha, there isn't much do to. But we wouldn't release a useless OS, right! There are currently three working programs. It's a lot, I know. The Nickel OS team was worked hard. What would you like to do?"
  57. answerindex = ["Games", "Other", "I am not as cool as I wish I was.", "Shut down.", "TM"]
  58. answer = raw_input("For a full list of games, type 'Games'. For a list of other programs, type 'Other'. If you are no fun and want to leave, type 'I am not as cool as I wish I was.' To shut down, type 'Shut down.' To go to the task manager, type 'TM'.")
  59. if answer == answerindex[0]: # games
  60. game = raw_input("Games are always a fun way to waste time. At the moment, we only have one game. It's a wonderful RPG called Happy Leify. If you want to play, enter 'Play'. To go back to the main menu, enter 'Back'.")
  61. if game == 'Play':
  62. happyleify()
  63. print " "
  64. desktop_two()
  65. if game == 'Back':
  66. print " "
  67. desktop_two()
  68. else:
  69. print " "
  70. shutdown_bad()
  71. if answer == answerindex[1]: # other
  72. other = raw_input("The Nickel OS programmers have included two programs in the Alpha. One is called Mathy. Mathy is a simple tool for finding the area of a circle. In order to launch Mathy, enter 'Mathy'. The other program is called Lunch. Lunch helps decide what you should get for lunch if you are feeling unsure. To launch Lunch, just type 'Lunch'. To go back, enter 'Back'.")
  73. if other == 'Mathy':
  74. print " "
  75. mathy()
  76. print " "
  77. desktop_two()
  78. if other == 'Lunch':
  79. print " "
  80. lunch()
  81. print " "
  82. desktop_two()
  83. if other == 'Back':
  84. desktop()
  85. else:
  86. print " "
  87. shutdown_bad()
  88. elif answer == answerindex[2]:
  89. print " "
  90. shutdown_mean()
  91. elif answer == answerindex[3]:
  92. shutdown()
  93. elif answer == answerindex[4]:
  94. Task_Manager()
  95. else:
  96. shutdown_bad()
  97.  
  98. def desktop_two():
  99. print "Good to see you again, hope you enjoyed the activity. What would you like to do now?"
  100. answerindex = ["Games", "Other", "I am not as cool as I wish I was."]
  101. answer = raw_input("For a full list of games, type 'Games'. For a list of other programs, type 'Other'. If you are no fun and want to leave, type 'I am not as cool as I wish I was.'")
  102. if answer == answerindex[0]: # games
  103. game = raw_input("Games are always a fun way to waste time. At the moment, we only have one game. It's a wonderful RPG called Happy Leify. If you want to play, enter 'Play'. To go back to the main menu, enter 'Back'.")
  104. if game == 'Play':
  105. happyleify()
  106. desktop()
  107. if game == 'Back':
  108. desktop()
  109. else:
  110. print "You're smarter than this. Let's try again."
  111. desktop()
  112. if answer == answerindex[1]: # other
  113. other = raw_input("The Nickel OS programmers have included two programs in the Alpha. One is called Mathy. Mathy is a simple tool for finding the area of a circle. In order to launch Mathy, enter 'Mathy'. The other program is called Lunch. Lunch helps decide what you should get for lunch if you are feeling unsure. To launch Lunch, just type 'Lunch'. To go back, enter 'Back'.")
  114. if other == 'Mathy':
  115. mathy()
  116. desktop()
  117. if other == 'Lunch':
  118. lunch()
  119. desktop()
  120. if other == 'Back':
  121. desktop()
  122. if other == 'TM':
  123. Task_Manager()
  124. desktop()
  125. else:
  126. print "You aren't the sharpest knife, are you? Let's try again."
  127. desktop()
  128. elif answer == answerindex[2]:
  129. login()
  130. else:
  131. systemboot()
  132.  
  133. def shutdown_bad():
  134. print "You did something wrong. My security protocls require that I shut down. Better luck next time!"
  135.  
  136. def shutdown_mean():
  137. print "I didn't want to talk to you anyway."
  138. exit()
  139.  
  140. def shutdown():
  141. print "It's fine if you want to leave, I understand. Hope you come back soon!\nResarting in"
  142. def countdown(n):
  143. while n > 0:
  144. print n
  145. n = n - 1
  146. print "Shutting down... Goodbye"
  147. countdown(5)
  148.  
  149. def mathy():
  150. print "This is a program that will help you find the area of a circle for all the radii leading up to your input. PLEASE NOTE: This program can only compute radii up to 50 and PLEASE DO NOT INPUT LETTERS"
  151. radius = int(input("Input your radius of the circle: "))
  152. for radius in range(radius):
  153. if radius < 51:
  154. rsquared = radius ** 2
  155. area = rsquared * math.pi
  156. print "The area of a circle with a radius of", radius, "is", area, "."
  157. else:
  158. print "You idiot, you obviously didn't read the warning. You don't deserve the answer."
  159.  
  160. def happyleify(): # happy leify
  161. print "-" * 30
  162. print " H A P P Y L E I F Y "
  163. print "-" * 30
  164. print " "
  165. print " 1. Play Game"
  166. print " 2. View Credits"
  167. print " 3. Smoke W33d Evrydae"
  168. print " 4. MLG"
  169. print "-" * 30
  170. print " "
  171. number = raw_input("Input a number: ")
  172. number = int(number)
  173. if number == 1:
  174. 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."
  175. direction = raw_input("Which way will you go?")
  176. if direction == "left":
  177. 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."
  178. direction2 = raw_input("Which way will you go again? (Type ladder or cave)")
  179. if direction2 == "ladder":
  180. 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!"
  181. elif direction2 == "cave":
  182. 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."
  183. exit(0)
  184. elif direction == "right":
  185. print "Way to go! You walk straight into a sand pit. For a fierce viking, you're pretty dumb. Please try the game over."
  186. exit(0)
  187. elif number == 2:
  188. print "Game was made by James Robbins and Nick Demetriades. (And was trash.)"
  189. exit(0)
  190. elif number == 3:
  191. print "Snoop Dogg: 'Smoke Weed everyday'"
  192. exit(0)
  193. elif number == 4:
  194. print "DUN DUNDUNDUNDUN DUN"
  195. exit(0)
  196. else:
  197. print "You suck. Hit run and try again."
  198. exit(0)
  199. print "-" * 60
  200. print "PART 2"
  201. #This was made by Nick
  202. # This defines 'arg'
  203. def arg(choice2, choice3):
  204. # This asks the question and takes whatever answer you give it, then defines the answer as an integer
  205. choice2 = raw_input("Welcome back, Leif! Since the creators of this game are unoriginal, you have run into another split in the road. On the left, you see a dark sky and scary-looking mountains. On the right, you see a beautiful, sunny sky and gardens with miles of flowes and puppies. Which way will you go?\n\tSelect your choice number: \n\t1. Right \n\t2. Left")
  206. choice2 = int(choice2)
  207. #everything from here to line 20 tells you the story depending on what numbers you choose
  208. if choice2 == 1:
  209. print ("Welp, you don goofed. The wonderful skies and gardens were an illusion. The flowers are spikes, the puppies are lions, and the blue sky is actually a massive rainstorm. You have screwed yourself. The end.")
  210. elif choice2 == 2:
  211. choice3 = raw_input("Your risk payed off. After walking for two hours, you realise that what you saw was an illusion, and the sky is actually clear and the mountains are just bouncy castles. As you get closer, you notice children playing in the castles. However, when the kids notice you, they run away and hide. Will you keep going, or turn around?\n\tSelect your choice number: \n\t1. Keep going \n\t2. Turn around")
  212. choice3 = int(choice3)
  213. if choice3 == 1:
  214. print "Congratulations, you have made all the right choices. As you arrive to the bouncy castle, people pop out of hiding and surprise you with a suprise birthday party! You have a wonderful time and everyone lives happily ever after. The end."
  215. elif choice3 == 2:
  216. print "That's too bad. You have turned away from your birthday party. Now you have wasted everyone's time, including your own. Your birthday party never happens. The end."
  217. else:
  218. print ("Invalid number. Start over.")
  219. else:
  220. print "Invalid number. Start over."
  221. arg("Sunny Sky/Dark Sky", "Keep Going/Turn Around")
  222.  
  223. def lunch():
  224. senior = raw_input("Are you a senior?")
  225. if senior == 'yes':
  226. food = raw_input("Please input a random number from 1-12.")
  227. food = int(food)
  228. if food == 1:
  229. print "You want pizza."
  230. elif food == 2:
  231. print "You want a cookie."
  232. elif food == 3:
  233. print "You want chicken fingers."
  234. elif food == 4:
  235. print "You want onion rings."
  236. elif food == 5:
  237. print "You want a bacon, egg, and cheese."
  238. elif food == 6:
  239. print "You want a bacon, egg, and cheese on a croissant."
  240. elif food == 7:
  241. print "You want a croissant."
  242. elif food == 8:
  243. print "You want chips/candy."
  244. elif food == 9:
  245. print "You want Milanos."
  246. elif food == 10:
  247. print "You want Lisbon."
  248. elif food == 11:
  249. print "You want some Subway."
  250. elif food == 12:
  251. print "You want Blimpie."
  252. else:
  253. print "Sorry, that's not an option."
  254. exit(0)
  255. if senior == 'no':
  256. food = raw_input("Please input a random number from 1-11.")
  257. food = int(food)
  258. if food == 1:
  259. print "You want pizza."
  260. elif food == 2:
  261. print "You want a cookie."
  262. elif food == 3:
  263. print "You want chicken fingers."
  264. elif food == 4:
  265. print "You want onion rings."
  266. elif food == 5:
  267. print "You want a bacon, egg, and cheese."
  268. elif food == 6:
  269. print "You want a bacon, egg, and cheese on a croissant."
  270. elif food == 7:
  271. print "You want a croissant."
  272. elif food == 8:
  273. print "You want chips/candy."
  274. elif food == 9:
  275. print "You want Lisbon."
  276. elif food == 10:
  277. print "You want some Subway."
  278. elif food == 11:
  279. print "You want Blimpie."
  280. else:
  281. print "Sorry, that's not an option."
  282. def Task_Manager():
  283. print "This is the Task Manager"
  284. task = ['1. Games', '2. Fire Fox', '3. Google Chrome', '4. Calcutator']
  285. for t in task:
  286. print t
  287. manager = raw_input("would you like to close all tasks")
  288. if manager == "yes":
  289. print "1. Games\n2. Fire Fox\n3. Google Chrome\n4. Calcutator\nhave been removed"
  290. task.pop(0)
  291. task.pop(0)
  292. task.pop(0)
  293. task.pop(0)
  294. print task
  295. home = raw_input("would you like to go back to the desktop?")
  296. if home == "yes":
  297. desktop()
  298. else:
  299. print "\nsorry you have to\n"
  300. desktop()
  301. elif manager == "no":
  302. print "Do you want to close a certain task?"
  303. manager1 = int(raw_input("What task? (choose the number)"))
  304. if manager1 == 1:
  305. print task.pop(0), "has been removed"
  306. print task
  307. home = raw_input("would you like to go back to the desktop?")
  308. if home == "yes":
  309. desktop()
  310. else:
  311. print "\nsorry you have to\n"
  312. desktop()
  313. elif manager1 == 2:
  314. print task.pop(1), "has been removed"
  315. print task
  316. home = raw_input("would you like to go back to the desktop?")
  317. if home == "yes":
  318. desktop()
  319. else:
  320. print "\nsorry you have to\n"
  321. desktop()
  322. elif manager1 == 3:
  323. print task.pop(2), "has been removed"
  324. print task
  325. home = raw_input("would you like to go back to the desktop?")
  326. if home == "yes":
  327. desktop()
  328. else:
  329. print "\nsorry you have to\n"
  330. desktop()
  331. elif manager1 == 4:
  332. print task.pop(3), "has been removed"
  333. print task
  334. home = raw_input("would you like to go back to the desktop?")
  335. if home == "yes":
  336. desktop()
  337. else:
  338. print "\nsorry you have to\n"
  339. desktop()
  340. else:
  341. print "not a valid input"
  342. Task_Manager()
  343. systemboot()
  344. stats()
  345. badboot()
  346. login()
  347. desktop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement