Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.23 KB | None | 0 0
  1. places_to_visit_in_hallway = ('upper', 'lower', 'room1', 'room2', 'room3', 'room4')
  2. valid_places_for_room1 = ('sofa', 'table', 'TV', 'Playstation4', 'bookshelf')
  3. location = 'hallway'
  4. inventory = []
  5. entrance_map = ('|Livingroom|', '|', 'Hallway', '|', '|Kitchen|\n',
  6. '|Hallway|', ' ', ' ' '|'' Hallway', '|', '|Hallway|\n',
  7. '|Diningroom|', '|', 'Entrance', '|', '|Family Room|\n'
  8. )
  9. help = ('If you are outside a room:\n'
  10. 'Type - go to and state a destination\n'
  11. 'If you are inside a room:\n'
  12. 'Type - go to and state a destination\n'
  13. 'or\n'
  14. 'Type - take and specify what\n'
  15. 'If you are inside or outside a room:\n'
  16. 'Type - map - shows you the surroundings\n'
  17. 'Type - inventory - shows you what your inventory contains\n'
  18. 'Type - go to upper/lower if you want to change to floor\n'
  19. 'If you are inside a room:\n'
  20. 'Type - leave to leave the room\n'
  21. 'If you are outside a room:'
  22. 'Type - exit to leave the game')
  23.  
  24.  
  25. class InputHandler:
  26. @staticmethod
  27. def Input():
  28. command = input()
  29. commandarray = command.split()
  30. return commandarray
  31.  
  32. @staticmethod
  33. def check_input(location, commandarray):
  34. if location == "hallway":
  35. if commandarray[0] == 'HELP':
  36. print("({})".format("".join(help)))
  37. return True
  38. if commandarray[0] == 'go':
  39. FirstFloor.go_function(commandarray)
  40. return True
  41.  
  42. elif commandarray[0] == 'map':
  43. print("({})".format("".join(entrance_map)))
  44. return True
  45.  
  46. elif commandarray[0] == 'inventory':
  47. print(inventory)
  48. return True
  49.  
  50. elif commandarray[0] == 'exit':
  51. return False
  52.  
  53. else:
  54. print("You have entered a invalid command!")
  55. return False
  56.  
  57. if location == 'room1':
  58. FirstFloor.entering_Room_one()
  59.  
  60. if location == 'room2':
  61. FirstFloor.entering_Room_two()
  62.  
  63. if location == 'room3':
  64. FirstFloor.entering_Room_three()
  65.  
  66. if location == 'room4':
  67. FirstFloor.entering_Room_four()
  68.  
  69.  
  70. class FirstFloor:
  71. def __init__(self, inventory, location):
  72. self.inventory = inventory
  73. self.location = location
  74.  
  75. @staticmethod
  76. def floor_message():
  77. print("WELCOME PLAYER ! You are currently on the first\n"
  78. "floor and this is where your journey begins\n"
  79. "I wish you good luck and have fun !\n"
  80. "Start playing by typing a desired command\n"
  81. "if you don't know what to type, please type\n"
  82. "'HELP' to check the commands.")
  83.  
  84. @staticmethod
  85. def handle_desk():
  86. print("You come to the desk and look\n"
  87. "at the computer, but it only has\n"
  88. "ubuntu on it, so you can't even\n"
  89. "play some game on it...")
  90. print("What do you want to do now?")
  91. command = InputHandler.Input()
  92. FirstFloor.action_in_fourth_room(command)
  93.  
  94. @staticmethod
  95. def handle_bed():
  96. print("You come to the bed and see a old\n"
  97. "tetris on it. You play a little bit\n"
  98. "but it crashes, just before you can\n"
  99. "beat the highscore, so you get angry\n"
  100. "and start wanting to leave this house\n"
  101. "even more than before")
  102. print("What do you want to do now ?")
  103. command = InputHandler.Input()
  104. FirstFloor.action_in_fourth_room(command)
  105.  
  106. @staticmethod
  107. def entering_Room_four():
  108. print("Do you wish to enter the room ?\n"
  109. "Yes or No")
  110. command = input()
  111. if command == 'Yes':
  112. location = "room4"
  113. print("Once in the fourth room\n"
  114. "you see a bed on your left\n"
  115. "in front of the bed there is a\n"
  116. "desk with a computer on it")
  117. fourth_room_commands = InputHandler.Input()
  118. FirstFloor.action_in_fourth_room(fourth_room_commands)
  119.  
  120. else:
  121. print("Are you sure you don't want to enter ?\n"
  122. "Yes or No ? for the last time..")
  123. command = input()
  124.  
  125. if command == 'Yes':
  126. print("Ok, you are going back to the Hallway")
  127. print("What do you wish to do now ?")
  128. location = 'hallway'
  129. variable = InputHandler.Input()
  130. InputHandler.check_input(location, variable)
  131.  
  132. else:
  133. print("Once in the fourth room\n"
  134. "you see a bed on your left\n"
  135. "in front of the bed there is a\n"
  136. "desk with a computer on it")
  137. print("What do you chose to do now ?")
  138. fourth_room_commands = InputHandler.Input()
  139. FirstFloor.action_in_fourth_room(fourth_room_commands)
  140.  
  141. @staticmethod
  142. def action_in_fourth_room(fourth_room_commands):
  143. valid_places = ('bed', 'desk')
  144. while(FirstFloor.check_commands_for_fourth_room(fourth_room_commands, valid_places)==True):
  145. command = input()
  146. fourth_room_commands = command.split()
  147.  
  148. @staticmethod
  149. def check_commands_for_fourth_room(fourth_room_commands,valid_places):
  150. if fourth_room_commands[0] == 'HELP':
  151. print("({})".format("".join(help)))
  152. return True
  153. if fourth_room_commands[0] == 'leave':
  154. print("You have left the room\n"
  155. "and are back in the hallway\n"
  156. "what do you want to do now ?")
  157. return False
  158. if fourth_room_commands[0] == 'map':
  159. print("Once in the fourth room\n"
  160. "you see a bed on your left\n"
  161. "in front of the bed there is a\n"
  162. "desk with a computer on it")
  163. return True
  164. if fourth_room_commands[0] == 'inventory':
  165. print(inventory)
  166. return True
  167. if len(fourth_room_commands) < 2:
  168. print("You didn't enter enough commands.\n"
  169. "Please type HELP if you don't know what to type!")
  170. return False
  171. elif len(fourth_room_commands) == 2:
  172. if fourth_room_commands[1] == 'to':
  173. print("You didn't state your destination!\n"
  174. "Please state where you want to go!")
  175. return True
  176. else:
  177. print("Invalid command! Please type HELP if you don't know the commands!")
  178.  
  179. elif len(fourth_room_commands) == 3:
  180.  
  181. if fourth_room_commands[2] in valid_places:
  182. print("You are going to " + fourth_room_commands[2])
  183. if fourth_room_commands[2] == 'bed':
  184. FirstFloor.handle_bed()
  185. return False
  186. elif fourth_room_commands[2] == 'desk':
  187. FirstFloor.handle_desk()
  188. return False
  189. else:
  190. print("You have entered a invalid third statement.\n"
  191. "Maybe you meant to write: bed\n"
  192. "desk")
  193. return True
  194. else:
  195. print("You have entered a invalid second statement.\n"
  196. "Maybe you meant to write: to")
  197. return False
  198.  
  199. @staticmethod
  200. def handle_inflatablebed():
  201. print("You come to the bed and look around\n"
  202. "it but you don't notice anything special,\n"
  203. "besides the fact of how smelly it is..")
  204. print("What do you want to do now?")
  205. command = InputHandler.Input()
  206. FirstFloor.action_in_third_room(command)
  207.  
  208. @staticmethod
  209. def entering_Room_three():
  210. print("Do you wish to enter the room ?\n"
  211. "Yes or No")
  212. command = input()
  213. if command == 'Yes':
  214. location = "room3"
  215. print("Once in the third room\n"
  216. "you notice that there is only a\n"
  217. "inflatable bed on the middle of the room")
  218. third_room_commands = InputHandler.Input()
  219. FirstFloor.action_in_third_room(third_room_commands)
  220.  
  221. else:
  222. print("Are you sure you don't want to enter ?\n"
  223. "Yes or No ? for the last time..")
  224. command = input()
  225.  
  226. if command == 'Yes':
  227. print("Ok, you are going back to the Hallway")
  228. print("What do you wish to do now ?")
  229. location = 'hallway'
  230. variable = InputHandler.Input()
  231. InputHandler.check_input(location, variable)
  232.  
  233. else:
  234.  
  235. print("Once in the third room\n"
  236. "you notice that there is only a\n"
  237. "inflatable bed on the middle of the room")
  238. print("What do you chose to do now ?")
  239. third_room_commands = InputHandler.Input()
  240. FirstFloor.action_in_third_room(third_room_commands)
  241.  
  242. @staticmethod
  243. def action_in_third_room(third_room_commands):
  244. valid_places = ('inflatablebed')
  245. while(FirstFloor.check_commands_for_third_room(third_room_commands, valid_places)==True):
  246. command = input()
  247. third_room_commands = command.split()
  248.  
  249. @staticmethod
  250. def check_commands_for_third_room(third_room_commands,valid_places):
  251. if third_room_commands[0] == 'HELP':
  252. print("({})".format("".join(help)))
  253. return True
  254.  
  255. if third_room_commands[0] == 'leave':
  256. print("You have left the room\n"
  257. "and are back in the hallway\n"
  258. "what do you want to do now ?")
  259. return False
  260. if third_room_commands[0] == 'map':
  261. print("Once in the third room\n"
  262. "you notice that there is only a\n"
  263. "inflatable bed on the middle of the room")
  264. return True
  265.  
  266. if third_room_commands[0] == 'inventory':
  267. print(inventory)
  268. return True
  269. if len(third_room_commands) < 2:
  270. print("You didn't enter enough commands.\n"
  271. "Please type HELP if you don't know what to type!")
  272. return False
  273. elif len(third_room_commands) == 2:
  274. if third_room_commands[1] == 'to':
  275. print("You didn't state your destination!\n"
  276. "Please state where you want to go!")
  277. return True
  278. else:
  279. print("Invalid command! Please type HELP if you don't know the commands!")
  280.  
  281. elif len(third_room_commands) == 3:
  282.  
  283. if third_room_commands[2] in valid_places:
  284. print("You are going to " + third_room_commands[2])
  285. if third_room_commands[2] == 'inflatablebed':
  286. FirstFloor.handle_inflatablebed()
  287. return False
  288. else:
  289. print("You have entered a invalid third statement.\n"
  290. "Maybe you meant to write: inflatablebed")
  291. return True
  292. else:
  293. print("You have entered a invalid second statement.\n"
  294. "Maybe you meant to write: to")
  295. return False
  296.  
  297. @staticmethod
  298. def handle_oven():
  299. if "SecondRoom-Key" in inventory:
  300. print("You already came here and took\n"
  301. "the key... What more do you want from\n"
  302. "an oven ?")
  303. print("What do you want to do now?")
  304. command = InputHandler.Input()
  305. FirstFloor.action_in_second_room(command)
  306. else:
  307. print("The oven is a bit rusty so\n"
  308. "you can't see inside, do you\n"
  309. "wish to open it ?")
  310. command = input("Yes or No?: ")
  311. if command == "Yes":
  312. print("You open the oven and find\n"
  313. "a key.")
  314. command = input("Do you wish to take it? Yes/No ?")
  315. if command == "Yes":
  316. print("You took this key inside your inventory !\n"
  317. "You can now check your inventory to see\n"
  318. "the items inside!")
  319. inventory.append("SecondRoom-Key")
  320. print("What do you want to do now?")
  321. command = InputHandler.Input()
  322. FirstFloor.action_in_second_room(command)
  323. else:
  324. print("Well ok, what do you want to do now, crazy head ?")
  325. command = InputHandler.Input()
  326. FirstFloor.action_in_second_room(command)
  327. else:
  328. print("Ok, what do you want to do now ?")
  329. command = InputHandler.Input()
  330. FirstFloor.action_in_second_room(command)
  331.  
  332. @staticmethod
  333. def handle_secondtable():
  334. print("You come to the table and see\n"
  335. "that it has some writing carved\n"
  336. "on it. You read the following:"
  337. "\"What is useful, but burns when,\n"
  338. "you're not careful\"")
  339. print("What do you wish to do now ?")
  340. command = InputHandler.Input()
  341. FirstFloor.action_in_second_room(command)
  342.  
  343. @staticmethod
  344. def handle_drawers():
  345. print("You come to drawers and open\n"
  346. "each one, but the only things\n"
  347. "you can find are knives and forks\n")
  348. command = input("Do you wish to take one of the knives ? Yes/No?")
  349. if command == "Yes":
  350. #this knife will be used on the last floor to open the easter egg
  351. print("Ok, now you have your knife in your inventory")
  352. inventory.append("knive")
  353. print("What do you want to do now?")
  354. command = InputHandler.Input()
  355. FirstFloor.action_in_second_room(command)
  356. else:
  357. print("Ok, then, what do you want to do now ?")
  358. command = InputHandler.Input()
  359. FirstFloor.action_in_second_room(command)
  360.  
  361. @staticmethod
  362. def handle_washingmachine():
  363. print("You come to the washing machine\n"
  364. "and manage to open it, but unfortunately\n"
  365. "as you expected, you find nothing other than\n"
  366. "dirty dishes")
  367. print("What do you want to do now?")
  368. command = InputHandler.Input()
  369. FirstFloor.action_in_second_room(command)
  370.  
  371. @staticmethod
  372. def entering_Room_two():
  373. print("Do you wish to enter the room ?\n"
  374. "Yes or No")
  375. command = input()
  376. if command == 'Yes':
  377. location = "room2"
  378. print("Once in the second room you look around\n"
  379. "and see a table in the middle of the room\n"
  380. "and on your right you have a couple of\n"
  381. "half closed drawers, on your left there\n"
  382. "is a oven and washing machine")
  383.  
  384. second_room_commands = InputHandler.Input()
  385. FirstFloor.action_in_second_room(second_room_commands)
  386.  
  387. else:
  388. print("Are you sure you don't want to enter ?\n"
  389. "Yes or No ? for the last time..")
  390. command = input()
  391.  
  392. if command == 'Yes':
  393. print("Ok, you are going back to the Hallway")
  394. print("What do you wish to do now ?")
  395. location = 'hallway'
  396. variable = InputHandler.Input()
  397. InputHandler.check_input(location, variable)
  398.  
  399. else:
  400. print("Once in the second room you look around\n"
  401. "and see a table in the middle of the room\n"
  402. "and on your right you have a couple of\n"
  403. "half closed drawers, on your left there\n"
  404. "is a oven and washing machine")
  405. print("What do you chose to do now ?")
  406. second_room_commands = InputHandler.Input()
  407. FirstFloor.action_in_second_room(second_room_commands)
  408.  
  409. @staticmethod
  410. def action_in_second_room(second_room_commands):
  411. valid_places = ('drawers','table','washingmachine','oven')
  412. while(FirstFloor.check_commands_for_second_room(second_room_commands, valid_places)==True):
  413. command = input()
  414. second_room_commands = command.split()
  415.  
  416. @staticmethod
  417. def check_commands_for_second_room(second_room_commands,valid_places):
  418. if second_room_commands[0] == 'HELP':
  419. print("({})".format("".join(help)))
  420. return True
  421.  
  422. if second_room_commands[0] == 'leave':
  423. print("You have left the room\n"
  424. "and are back in the hallway\n"
  425. "what do you want to do now ?")
  426. return False
  427. if second_room_commands[0] == 'map':
  428. print("Once in the second room you look around\n"
  429. "and see a table in the middle of the room\n"
  430. "and on your right you have a couple of\n"
  431. "half closed drawers, on your left there\n"
  432. "is a oven and washing machine")
  433. return True
  434. if second_room_commands[0] == 'inventory':
  435. print(inventory)
  436. return True
  437. if len(second_room_commands) < 2:
  438. print("You didn't enter enough commands.\n"
  439. "Please type HELP if you don't know what to type!")
  440. return False
  441. elif len(second_room_commands) == 2:
  442. if second_room_commands[1] == 'to':
  443. print("You didn't state your destination!\n"
  444. "Please state where you want to go!")
  445. return True
  446. else:
  447. print("Invalid command! Please type HELP if you don't know the commands!")
  448.  
  449. elif len(second_room_commands) == 3:
  450.  
  451. if second_room_commands[2] in valid_places:
  452. print("You are going to " + second_room_commands[2])
  453. if second_room_commands[2] == 'oven':
  454. FirstFloor.handle_oven()
  455. return False
  456. elif second_room_commands[2] == 'table':
  457. FirstFloor.handle_secondtable()
  458. return False
  459. elif second_room_commands[2] == 'drawers':
  460. FirstFloor.handle_drawers()
  461. return False
  462. elif second_room_commands[2] == 'washingmachine':
  463. FirstFloor.handle_washingmachine()
  464. return False
  465. else:
  466. print("You have entered a invalid third statement.\n"
  467. "Maybe you meant to write: table\n"
  468. "drawers\n"
  469. "oven\n"
  470. "washingmachine\n")
  471. return True
  472. else:
  473. print("You have entered a invalid second statement.\n"
  474. "Maybe you meant to write: to")
  475. return False
  476.  
  477. @staticmethod
  478. def handle_sofa():
  479. print("You look around the sofa, but\n"
  480. "unfortunately there seems to be\n"
  481. "no clues here")
  482. print("What do you wish to do now ?")
  483. first_room_commands = InputHandler.Input()
  484. FirstFloor.action_in_first_room(first_room_commands)
  485.  
  486. @staticmethod
  487. def handle_table():
  488. print("You came to the table and\n"
  489. "took the letter from it.\n"
  490. "Once you open the letter,\n"
  491. "you find the following message: \n"
  492. "\"Get busy living or get busy dying\"")
  493. print("Hmmm.. this seems to be some sort of a clue..")
  494. print("What do you wish to do now?")
  495. first_room_commands = InputHandler.Input()
  496. FirstFloor.action_in_first_room(first_room_commands)
  497.  
  498. @staticmethod
  499. def handle_TV():
  500. print("You came to look at the TV\n"
  501. "but unfortunately there isn't \n"
  502. "any clue here..")
  503. print("What do you wish to do now?")
  504. first_room_commands = InputHandler.Input()
  505. FirstFloor.action_in_first_room(first_room_commands)
  506.  
  507. @staticmethod
  508. def handle_playstation():
  509. print("You came to look at the PS\n"
  510. "but you saw that it had only \n"
  511. "fifa 2019, so it was in no interest\n"
  512. "to you..")
  513. print("What do you wish to do now?")
  514. first_room_commands = InputHandler.Input()
  515. FirstFloor.action_in_first_room(first_room_commands)
  516.  
  517. @staticmethod
  518. def handle_bookshelf():
  519. print("You come to the bookshelf and see\n"
  520. "a couple of books. The authors of the \n"
  521. "books are \"Stephen King\",\n"
  522. "\"Hamlet\", \"Ivan Vazov\"")
  523.  
  524. print("Do you wish to grab one of the books ?")
  525. command = input("Yes or No ? ")
  526. if command == 'Yes':
  527. print("Which author's book do you wish to grab ?")
  528. command = input("Type Stephen or Hamlet or Ivan Vazov")
  529. if command == 'Stephen':
  530. if "clue" in inventory:
  531. print("You already opened King's\n"
  532. "book, you crazy.\n"
  533. "Now what is the next adequate thing you want to do ?")
  534. command = InputHandler.Input()
  535. FirstFloor.action_in_first_room(command)
  536. else:
  537. print("You opened Stephen King's book\n"
  538. "inside you found a key and a clue that says the following: \n"
  539. "\"Escape comes for those who never fear going up\"")
  540. print("Do you wish to take the key with you?")
  541. command = input("Type 'take key' if you wish to take it")
  542. if command =='take key':
  543. inventory.append('key')
  544. print("You can now check your inventory to see what items\n"
  545. "you have inside it!")
  546. print("What do you wish to do now ?")
  547. first_room_commands = InputHandler.Input()
  548. FirstFloor.action_in_first_room(first_room_commands)
  549.  
  550. else:
  551. print("Guess you have good memory, what do you want to do now ?")
  552. first_room_commands = InputHandler.Input()
  553. FirstFloor.action_in_first_room(first_room_commands)
  554. else:
  555. print("You open the book, but find nothing special in it")
  556. print("What do you want to do now? You can return\n"
  557. "to the bookshelf to try another book")
  558. first_room_commands = InputHandler.Input()
  559. FirstFloor.action_in_first_room(first_room_commands)
  560.  
  561. else:
  562. print("Ok then, what do you wish to do now ?")
  563. first_room_commands = InputHandler.Input()
  564. FirstFloor.action_in_first_room(first_room_commands)
  565.  
  566. @staticmethod
  567. def go_function(commandarray):
  568. if len(commandarray) < 2:
  569. print("You didn't enter enough commands.\n"
  570. "Please type HELP if you don't know what to type!")
  571. return False
  572. elif len(commandarray) == 2:
  573. if commandarray[1] == 'to':
  574. print("You didn't state your destination!\n"
  575. "Please state where you want to go!")
  576. return True
  577. else:
  578. print("Invalid command! Please type HELP if you don't know the commands!")
  579.  
  580. elif len(commandarray) == 3:
  581. if commandarray[2] == 'upper':
  582. if 'key' in inventory:
  583. print("Ok you are going to the second floor")
  584. return False
  585. else:
  586. print("You have to find the key for the second\n"
  587. "floor, before you can go there")
  588. return True
  589.  
  590. if commandarray[2] == 'lower':
  591. if 'basement-key' in inventory:
  592. print("Ok you are going to the basement")
  593. return False
  594. else:
  595. print("You have to find the key for the basement,\n"
  596. "before you can go there")
  597. return True
  598.  
  599. if commandarray[2] in places_to_visit_in_hallway:
  600. print("You are going to " + commandarray[2])
  601. location = commandarray[2]
  602. InputHandler.check_input(location, commandarray[2])
  603. return True
  604. else:
  605. print("You have entered a invalid third statement.\n"
  606. "Maybe you meant to write: upper\n"
  607. "lower\n"
  608. "first room->room1\n"
  609. "second room->room2\n"
  610. "third room->room3\n"
  611. "fourth room->room4")
  612. return True
  613. else:
  614. print("You have entered a invalid second statement.\n"
  615. "Maybe you meant to write: to")
  616. return False
  617.  
  618. @staticmethod
  619. def entering_Room_one():
  620. print("Do you wish to enter the room ?\n"
  621. "Yes or No")
  622. command = input()
  623. if command == 'Yes':
  624. location = 'room1'
  625. print("You have entered the first room!\n"
  626. "In front of you, on the left side of the room,\n"
  627. "there is a sofa with a coffee table\n"
  628. "in front of it. On the right of the room\n"
  629. "in front of the coffee table there is a\n"
  630. "playstation4 with a TV. At the end of the room\n"
  631. "right in front of you, there is a book shelf.\n"
  632. "The first thing you notice is that there is a\n"
  633. "LETTER on the coffe table")
  634. print("What do you chose to do now ?")
  635. first_room_commands = InputHandler.Input()
  636. FirstFloor.action_in_first_room(first_room_commands)
  637.  
  638. else:
  639. print("Are you sure you don't want to enter ?\n"
  640. "Yes or No ? for the last time..")
  641. command = input()
  642.  
  643. if command == 'Yes':
  644. print("Ok, you are going back to the Hallway")
  645. print("What do you wish to do now ?")
  646. location = 'hallway'
  647. variable = InputHandler.Input()
  648. InputHandler.check_input(location, variable)
  649.  
  650. else:
  651. print("You have entered the first room!\n"
  652. "In front of you, on the left side of the room,\n"
  653. "there is a sofa with a coffee table\n"
  654. "in front of it. On the right of the room\n"
  655. "in front of the coffee table there is a\n"
  656. "playstation4 with a TV. At the end of the room\n"
  657. "right in front of you, there is a book shelf.\n"
  658. "The first thing you notice is that there is a\n"
  659. "LETTER on the coffe table")
  660. print("What do you chose to do now ?")
  661. first_room_commands = InputHandler.Input()
  662. FirstFloor.action_in_first_room(first_room_commands)
  663.  
  664. @staticmethod
  665. def action_in_first_room(first_room_commands):
  666. valid_places = ('sofa','table','TV','Playstation4','bookshelf')
  667. while(FirstFloor.check_commands_for_first_room(first_room_commands, valid_places)==True):
  668. command = input()
  669. first_room_commands = command.split()
  670.  
  671. @staticmethod
  672. def check_commands_for_first_room(first_room_commands,valid_places):
  673. if first_room_commands[0] == 'HELP':
  674. print("({})".format("".join(help)))
  675. return True
  676.  
  677. if first_room_commands[0] == 'leave':
  678. print("You have left the room\n"
  679. "and are back in the hallway\n"
  680. "what do you want to do now ?")
  681. return False
  682. if first_room_commands[0] == 'map':
  683. print("You have entered the first room!\n"
  684. "In front of you, on the left side of the room,\n"
  685. "there is a sofa with a coffee table\n"
  686. "in front of it. On the right of the room\n"
  687. "in front of the coffee table there is a\n"
  688. "playstation4 with a TV. At the end of the room\n"
  689. "right in front of you, there is a book shelf.\n"
  690. "The first thing you notice is that there is a\n"
  691. "LETTER on the coffe table")
  692. return True
  693. if first_room_commands[0] == 'inventory':
  694. print(inventory)
  695. return True
  696. if len(first_room_commands) < 2:
  697. print("You didn't enter enough commands.\n"
  698. "Please type HELP if you don't know what to type!")
  699. return False
  700. elif len(first_room_commands) == 2:
  701. if first_room_commands[1] == 'to':
  702. print("You didn't state your destination!\n"
  703. "Please state where you want to go!")
  704. return True
  705. else:
  706. print("Invalid command! Please type HELP if you don't know the commands!")
  707.  
  708. elif len(first_room_commands) == 3:
  709.  
  710. if first_room_commands[2] in valid_places:
  711. print("You are going to " + first_room_commands[2])
  712. if first_room_commands[2] == 'sofa':
  713. FirstFloor.handle_sofa()
  714. return False
  715. elif first_room_commands[2] == 'table':
  716. FirstFloor.handle_table()
  717. return False
  718. elif first_room_commands[2] == 'TV':
  719. FirstFloor.handle_TV()
  720. return False
  721. elif first_room_commands[2] == 'bookshelf':
  722. FirstFloor.handle_bookshelf()
  723. return False
  724. elif first_room_commands[2] == 'Playstation4':
  725. FirstFloor.handle_playstation()
  726. return False
  727. else:
  728. print("You have entered a invalid third statement.\n"
  729. "Maybe you meant to write: sofa\n"
  730. "table\n"
  731. "bookshelf\n"
  732. "TV\n"
  733. "Playstation4\n")
  734. return True
  735. else:
  736. print("You have entered a invalid second statement.\n"
  737. "Maybe you meant to write: to")
  738. return False
  739.  
  740.  
  741. FirstFloor(inventory, location).floor_message()
  742. variable = InputHandler.Input()
  743. secondvariable = InputHandler.check_input(location, variable)
  744.  
  745. while(secondvariable == True):
  746. variable = InputHandler.Input()
  747. secondvariable = InputHandler.check_input(location, variable)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement