Advertisement
Guest User

Untitled

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