Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.07 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class EscapeRoom{
  3. public static String password = "Pw08191976";
  4. public static boolean on = false;
  5. public static String userName = "";
  6. public static void main(String[] args) throws InterruptedException{
  7. Scanner console = new Scanner(System.in);
  8. intro();
  9. String input = console.nextLine();
  10. while(!input.equalsIgnoreCase("Quit")){
  11. input = console.nextLine();
  12. }
  13. }
  14. public static void intro() throws InterruptedException{
  15. System.out.println("As you gradually open your eyes, you realize ");
  16. Thread.sleep(2300);
  17. System.out.println("you are in Mr.Binz' AP Java classroom.");
  18. Thread.sleep(2300);
  19. System.out.print("However, you have no memory of what you were just doing");
  20. dots();
  21. Thread.sleep(2150);
  22. System.out.println("While rubbing the weariness from your eyes, ");
  23. Thread.sleep(2300);
  24. System.out.println("you notice that it is pitch black outside.");
  25. Thread.sleep(2300);
  26. System.out.println("You get up slowly and casually walk to the exit ");
  27. Thread.sleep(2300);
  28. System.out.println("only to grasp that it's locked.");
  29. Thread.sleep(2300);
  30. System.out.println("");
  31. System.out.println("╔══════════════════════╗");
  32. System.out.println("\tEscape Room");
  33. System.out.println("\tJuan HeeSoo");
  34. System.out.println("╚══════════════════════╝");
  35. System.out.println("");
  36. userName = getUsername();
  37. description();
  38. }
  39. public static String getUsername() throws InterruptedException{
  40. Scanner console = new Scanner(System.in);
  41. Thread.sleep(750);
  42. System.out.println("▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬");
  43. Thread.sleep(750);
  44. System.out.println("Enter a username: ");
  45. String name = console.next();
  46. Thread.sleep(750);
  47. System.out.println("Welcome to the Escape Room");
  48. System.out.println("\t" + name);
  49. Thread.sleep(500);
  50. System.out.println("");
  51. Thread.sleep(500);
  52. System.out.println("Enter 'quit' to quit");
  53. Thread.sleep(750);
  54. System.out.println("▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬");
  55. Thread.sleep(750);
  56. System.out.println("");
  57. return name;
  58. }
  59. public static void description() throws InterruptedException{
  60. Thread.sleep(950);
  61. System.out.println("Suddenly, the TV flickers to life!");
  62. Thread.sleep(1900);
  63. System.out.print("Behind a wall of static, you notice a figure");
  64. dots();
  65. Thread.sleep(2350);
  66. System.out.println("▬[Mr Binz]▬▬▬▬▬▬▬▬▬▬▬▬ ");
  67. System.out.println("Hello there, " + userName );
  68. Thread.sleep(1750);
  69. System.out.println("It seems like you have awoken. ");
  70. Thread.sleep(1750);
  71. System.out.println("You're currently in room 334 taking part in my little expirement.");
  72. Thread.sleep(1750);
  73. System.out.println("To get out of my room, ");
  74. Thread.sleep(1750);
  75. System.out.println("you will need to solve a series of puzzles.");
  76. Thread.sleep(1750);
  77. System.out.println("Good luck, player");
  78. Thread.sleep(1750);
  79. System.out.println("▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ ");
  80. Thread.sleep(1700);
  81. System.out.println("And the TV blacks out!");
  82. puzzle0();
  83. }
  84. public static void puzzle0() throws InterruptedException{
  85. Thread.sleep(700);
  86. System.out.println("Hint: Use 'observe' to look around");
  87. Scanner console = new Scanner(System.in);
  88. String command = console.next();
  89. if (command.equalsIgnoreCase("observe")) {
  90. System.out.println("It seems like the same computer room you come");
  91. Thread.sleep(2250);
  92. System.out.println("to everyday. In the vicinity you see the COMPUTERS,");
  93. Thread.sleep(2250);
  94. System.out.print("SHELF, DOOR, and a TV");
  95. dots();
  96. Thread.sleep(2250);
  97. System.out.println("Why don't you 'look' around?");
  98. puzzle1();
  99. } else if(!command.equalsIgnoreCase("observe")) {
  100. System.out.println("Unknown command registered!");
  101. puzzle0();
  102. }
  103. }
  104. public static void puzzle1() throws InterruptedException{
  105. System.out.println("Hint: 'look' OBJECT");
  106. Scanner console = new Scanner(System.in);
  107. String command = console.next();
  108. String object = console.next();
  109. if (command.equalsIgnoreCase("look")) {
  110. if (object.equalsIgnoreCase("shelf")) {
  111. System.out.print("There seems to be a few MUGS and BINDERS");
  112. dots();
  113. Thread.sleep(2500);
  114. System.out.println("Suddenly, you feel a breeze coming from behind the shelf!");
  115. Thread.sleep(800);
  116. System.out.println("What will you do?");
  117. puzzle1a();
  118. } else if (object.equalsIgnoreCase("computers")) {
  119. System.out.print("You walk over to the computer and power it on");
  120. dots();
  121. Thread.sleep(1950);
  122. System.out.println("It looks like its locked!");
  123. Thread.sleep(1950);
  124. System.out.println("It needs a password");
  125. puzzle1();
  126. } else if (object.equalsIgnoreCase("door")) {
  127. System.out.println("You walk over to the door and try the handle.");
  128. Thread.sleep(1950);
  129. System.out.println("It seems to be locked!");
  130. Thread.sleep(1950);
  131. System.out.print("You peek out the windows, into the hallway");
  132. dots();
  133. Thread.sleep(1950);
  134. System.out.println("It's too dark to notice anything.");
  135. Thread.sleep(1950);
  136. System.out.println("As you take a step back, you notice a protruding keyhole,");
  137. System.out.println("under the handle.");
  138. puzzle1();
  139. } else if (object.equalsIgnoreCase("tv")) {
  140. System.out.println("You walk over to the tv.");
  141. Thread.sleep(1950);
  142. System.out.print("It seems like an old box tv");
  143. dots();
  144. System.out.println("Several BUTTONs seem to be lining the bottom.");
  145. Thread.sleep(1950);
  146. System.out.println("It seems be within a 'push' distance!");
  147. puzzle1e();
  148. } else {
  149. System.out.println("Unknown command registered!");
  150. puzzle1();
  151. }
  152. } else {
  153. System.out.println("Unknown command registered!");
  154. puzzle1();
  155. }
  156. }
  157. public static void puzzle1e() throws InterruptedException{
  158. System.out.println("Try 'push'ing some BUTTONs.");
  159. Scanner console = new Scanner(System.in);
  160. String command = console.next();
  161. String object = console.next();
  162. if (command.equalsIgnoreCase("push")) {
  163. if (object.equalsIgnoreCase("button")) {
  164. System.out.println("You push the power button on the TV.");
  165. Thread.sleep(1950);
  166. System.out.println("Nothing seems to happen.");
  167. Thread.sleep(1950);
  168. System.out.println("You try the other buttons.");
  169. Thread.sleep(1950);
  170. System.out.print("It seems to be dead");
  171. dots();
  172. puzzle1();
  173. } else {
  174. System.out.println("Unknown command registered!");
  175. puzzle1e();
  176. }
  177. } else {
  178. System.out.println("Unknown command registered!");
  179. puzzle1e();
  180. }
  181. }
  182. public static void puzzle1a() throws InterruptedException{
  183. System.out.println("Hint: There seems to be something behind the SHELF!");
  184. Thread.sleep(1200);
  185. System.out.print(" Maybe you can 'push' it out of the way");
  186. dots();
  187. Scanner console = new Scanner(System.in);
  188. String command = console.next();
  189. String object = console.next();
  190. if (command.equalsIgnoreCase("push")) {
  191. System.out.println("You push the shelf to find a dark, dusty room");
  192. Thread.sleep(2250);
  193. System.out.println("Within it, a lone table stands");
  194. Thread.sleep(2250);
  195. System.out.println("You see a thick BOOK sitting on top of it");
  196. puzzle1b();
  197. } else if(command.equalsIgnoreCase("observe")) {
  198. puzzle1();
  199. } else if(!command.equalsIgnoreCase("push")) {
  200. System.out.println("Unknown command registered!");
  201. puzzle1a();
  202. }
  203. }
  204. public static void puzzle1b() throws InterruptedException{
  205. System.out.println("You lift the heavy cover of the book and wipe off the coat of dust.");
  206. Thread.sleep(1950);
  207. System.out.println("On the cover it reads 'AP Java Class of 11111001011'"); //1995
  208. Thread.sleep(1950);
  209. System.out.println("As you begin to flip through the pages, you see the names and pictures of several students,");
  210. Thread.sleep(1950);
  211. System.out.println("who you don't recognize. Suddenly, a note falls to the ground.");
  212. Thread.sleep(1950);
  213. System.out.println("Dear Nathan, Happy 19th Birthday. Congrats on your graduation."); //happy birthday note. August 19 1976 from sidechar1 name later
  214. Thread.sleep(1950);
  215. System.out.println("Hopefully you had a good 2 months off of school. I'm sending this on the 14th because");
  216. Thread.sleep(1950);
  217. System.out.println("it usually takes around 5 days for my mail to get to you. Hopefully you get this on your");
  218. Thread.sleep(1950);
  219. System.out.println("birthday. From /-==-");
  220. dots();
  221. Thread.sleep(1650);
  222. System.out.println("The name is too faded to make out.");
  223. puzzle1c();
  224. }
  225. public static void puzzle1c() throws InterruptedException{
  226. Thread.sleep(1750);
  227. System.out.println("Hint: 'Look' somewhere else!");
  228. Scanner console = new Scanner(System.in);
  229. String command = console.next();
  230. String object = console.next();
  231. if (command.equalsIgnoreCase("look")) {
  232. if (object.equalsIgnoreCase("shelf")) {
  233. System.out.print("There seems to be a few MUGS and BINDERS");
  234. dots();
  235. Thread.sleep(2500);
  236. System.out.println("You have already searched this room, ");
  237. Thread.sleep(1500);
  238. System.out.println("would you like to look through it again?");
  239. puzzle1f();
  240. } else if (object.equalsIgnoreCase("computers")) {
  241. System.out.print("You walk over to the computer and power it on");
  242. dots();
  243. Thread.sleep(1950);
  244. System.out.println("On the bottom right corner a notification pops up");
  245. Thread.sleep(1950);
  246. System.out.println("The screen prompts for a password");
  247. Thread.sleep(1950);
  248. System.out.print("Underneath the password prompt, you can make out some small text");
  249. dots();
  250. Thread.sleep(1950);
  251. System.out.println("Passwords have been reset. Use PwMMDDYYYY as your passwords!");
  252. puzzle1g();
  253. } else if (object.equalsIgnoreCase("door")) {
  254. System.out.println("You walk over to the door and try the handle.");
  255. Thread.sleep(1950);
  256. System.out.println("It seems to be locked!");
  257. Thread.sleep(1950);
  258. System.out.print("You peek out the windows, into the hallway");
  259. dots();
  260. Thread.sleep(1950);
  261. System.out.println("It's too dark to notice anything.");
  262. Thread.sleep(1950);
  263. System.out.println("As you take a step back, you notice a protruding keyhole,");
  264. System.out.println("under the handle.");
  265. puzzle1c();
  266. } else if (object.equalsIgnoreCase("tv")) {
  267. System.out.println("You walk over to the tv.");
  268. Thread.sleep(1950);
  269. System.out.print("It seems like an old box tv");
  270. dots();
  271. puzzle1c();
  272. } else {
  273. System.out.println("Unknown command registered!");
  274. puzzle1c();
  275. }
  276. } else {
  277. System.out.println("Unknown command registered!");
  278. puzzle1c();
  279. }
  280. }
  281. public static void puzzle1f() throws InterruptedException{
  282. Scanner console = new Scanner(System.in);
  283. String command = console.next();
  284. if(command.equalsIgnoreCase("yes")) {
  285. puzzle1b();
  286. }else if(command.equalsIgnoreCase("no")) {
  287. puzzle1c();
  288. } else {
  289. System.out.println("Unknown command registered!");
  290. puzzle1f();
  291. }
  292. }
  293. public static void puzzle1g() throws InterruptedException{
  294. System.out.println("Enter a Password: ");
  295. Scanner console = new Scanner(System.in);
  296. String password = console.next();
  297. if(password.equals("Pw08191976")) {
  298. System.out.println("The computer opened");
  299. Thread.sleep(1650);
  300. System.out.println("A title named 'Subjects' is open");
  301. Thread.sleep(1650);
  302. System.out.println("They are logs describing the past escape room experiment.");
  303. Thread.sleep(1650);
  304. System.out.println("One particularly pops out, ");
  305. Thread.sleep(1650);
  306. System.out.println("There seems to be a note written on the side");
  307. Thread.sleep(1650);
  308. System.out.println("Test Subject 7, displayed erratice behavior before he loses consciousness");
  309. Thread.sleep(1650);
  310. System.out.println("He writes on the wall that 'the key is in the room'.");
  311. Thread.sleep(1650);
  312. System.out.println("The screen blacks out and the TV flickers back to life again!");
  313. puzzle2();
  314. }else if(password.equalsIgnoreCase("Logout")) {
  315. puzzle1c();
  316. } else {
  317. System.out.println("Wrong password");
  318. Thread.sleep(750);
  319. System.out.println("Enter 'logout' to return to the room");
  320. puzzle1g();
  321. }
  322. }
  323. public static void puzzle2() throws InterruptedException{
  324. System.out.println("▬[Mr Binz]▬▬▬▬▬▬▬▬▬▬▬▬ ");
  325. Thread.sleep(1750);
  326. System.out.println("So, " + userName );
  327. Thread.sleep(1750);
  328. System.out.println("It seems like you found some old experiment logs.");
  329. Thread.sleep(1750);
  330. System.out.println("However, I will congradulate you. None of the other");
  331. Thread.sleep(1750);
  332. System.out.println("test subjects have performed as brilliantly as you did.");
  333. Thread.sleep(1750);
  334. System.out.println("But like the rest of them, you will never escape this");
  335. Thread.sleep(1750);
  336. System.out.println("room.");
  337. Thread.sleep(1750);
  338. System.out.println("▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ ");
  339. Thread.sleep(1750);
  340. System.out.print("The screen abruptly turns off and leaves the room in darkness");
  341. dots();
  342. puzzle2a();
  343. }
  344. public static void puzzle2a() throws InterruptedException{
  345. System.out.println("You stare at the empty screen in silence.");
  346. System.out.println("Hint: Use 'look' to observe the SHELF, MUGS, COMPUTERS, and DOOR");
  347. Scanner console = new Scanner(System.in);
  348. String command = console.next();
  349. String object = console.next();
  350. if (command.equalsIgnoreCase("look")) {
  351. if (object.equalsIgnoreCase("shelf")) {
  352. System.out.print("There seems to be a few MUGS and BINDERS");
  353. dots();
  354. Thread.sleep(2500);
  355. System.out.println("You have already searched this room, ");
  356. Thread.sleep(1500);
  357. System.out.println("would you like to look through it again?");
  358. puzzle2a();
  359. } else if (object.equalsIgnoreCase("computers")) {
  360. System.out.print("You walk over to the computer and power it on");
  361. dots();
  362. Thread.sleep(1950);
  363. System.out.println("The screen is still black");
  364. Thread.sleep(1950);
  365. puzzle2a();
  366. } else if (object.equalsIgnoreCase("door")) {
  367. System.out.println("You walk over to the door and try the handle.");
  368. Thread.sleep(1950);
  369. System.out.println("It seems to be locked!");
  370. Thread.sleep(1950);
  371. System.out.print("You peek out the windows, into the hallway");
  372. dots();
  373. Thread.sleep(1950);
  374. System.out.println("It's too dark to notice anything.");
  375. Thread.sleep(1950);
  376. System.out.println("As you take a step back, you notice a protruding keyhole,");
  377. System.out.println("under the handle.");
  378. puzzle2a();
  379. } else if (object.equalsIgnoreCase("tv")) {
  380. System.out.println("You walk over to the tv.");
  381. Thread.sleep(1950);
  382. System.out.print("It seems like an old box tv");
  383. dots();
  384. puzzle2a();
  385. } else if (object.equalsIgnoreCase("binders")) {
  386. System.out.println("You take a look in the binders.");
  387. Thread.sleep(1950);
  388. System.out.print("There seems to be several school documents inside");
  389. dots();
  390. Thread.sleep(1950);
  391. System.out.println("None of them seem to be very important.");
  392. puzzle2a();
  393. } else if (object.equalsIgnoreCase("mugs")) {
  394. System.out.println("You take ahold of a mug and look inside.");
  395. Thread.sleep(1950);
  396. System.out.println("Even in the dark room, you can notice a small glint inside.");
  397. Thread.sleep(1950);
  398. System.out.print("You reach in and pull out a KEY");
  399. dots();
  400. Thread.sleep(1950);
  401. System.out.println("You take the key and put it in your back pocket.");
  402. puzzle3();
  403. } else {
  404. System.out.println("Unknown command registered!");
  405. puzzle2a();
  406. }
  407. } else {
  408. System.out.println("Unknown command registered!");
  409. puzzle2a();
  410. }
  411. }
  412. public static void puzzle3() throws InterruptedException{
  413. Thread.sleep(1750);
  414. System.out.println("Hint: 'Look' somewhere else!");
  415. Scanner console = new Scanner(System.in);
  416. String command = console.next();
  417. String object = console.next();
  418. if (command.equalsIgnoreCase("look")) {
  419. if (object.equalsIgnoreCase("shelf")) {
  420. System.out.print("There seems to be a few MUGS and BINDERS");
  421. dots();
  422. Thread.sleep(2500);
  423. System.out.println("You have already searched this room, ");
  424. Thread.sleep(1500);
  425. System.out.println("would you like to look through it again?");
  426. puzzle3();
  427. } else if (object.equalsIgnoreCase("computers")) {
  428. System.out.print("You walk over to the computer and power it on");
  429. dots();
  430. Thread.sleep(1950);
  431. System.out.println("The screen is still black");
  432. Thread.sleep(1950);
  433. puzzle3();
  434. } else if (object.equalsIgnoreCase("door")) {
  435. System.out.println("You walk over to the door and try the handle.");
  436. Thread.sleep(1950);
  437. System.out.println("It seems to be locked!");
  438. Thread.sleep(1950);
  439. System.out.print("You peek out the windows, into the hallway");
  440. dots();
  441. Thread.sleep(1950);
  442. System.out.println("It's too dark to notice anything.");
  443. Thread.sleep(1950);
  444. System.out.println("As you take a step back, you notice a protruding keyhole,");
  445. System.out.println("under the handle.");
  446. Thread.sleep(1950);
  447. System.out.println("You might be able to 'use' the KEY!");
  448. puzzle3a();
  449. } else if (object.equalsIgnoreCase("tv")) {
  450. System.out.println("You walk over to the tv.");
  451. Thread.sleep(1950);
  452. System.out.print("It seems like an old box tv");
  453. dots();
  454. puzzle3();
  455. } else if (object.equalsIgnoreCase("binders")) {
  456. System.out.println("You take a look in the binders.");
  457. Thread.sleep(1950);
  458. System.out.print("There seems to be several school documents inside");
  459. dots();
  460. Thread.sleep(1950);
  461. System.out.println("None of them seem to be very important.");
  462. puzzle3();
  463. } else if (object.equalsIgnoreCase("mugs")) {
  464. System.out.println("You take ahold of a mug and look inside.");
  465. Thread.sleep(1950);
  466. System.out.println("There doesn't seem to be anything inside.");
  467. Thread.sleep(1950);
  468. System.out.print("You put it back in place.");
  469. puzzle3();
  470. } else {
  471. System.out.println("Unknown command registered!");
  472. puzzle3();
  473. }
  474. } else {
  475. System.out.println("Unknown command registered!");
  476. puzzle3();
  477. }
  478. }
  479. public static void puzzle3a() throws InterruptedException{
  480. Scanner console = new Scanner(System.in);
  481. String command = console.next();
  482. String object = console.next();
  483. if (command.equalsIgnoreCase("use")) {
  484. if (object.equalsIgnoreCase("key")) {
  485. System.out.println("You reach into your pocket and pull out a key.");
  486. Thread.sleep(1950);
  487. System.out.print("You start inserting the key into the lock");
  488. dots();
  489. Thread.sleep(1750);
  490. System.out.println("To your surprise, it slides into place with a click.");
  491. Thread.sleep(2450);
  492. System.out.println("You slowly turn the key and you hear the bolt retract.");
  493. Thread.sleep(1950);
  494. System.out.println("As you push the door open and walk out into a long open hallway");
  495. Thread.sleep(1950);
  496. System.out.println("you notice that the hallway looks strange,");
  497. Thread.sleep(1950);
  498. System.out.print("like it's spinning");
  499. dots();
  500. Thread.sleep(1950);
  501. System.out.println("You fall to your knees and the edges of your vision begin to darken!");
  502. Thread.sleep(1950);
  503. System.out.print("You can feel your conciousness begining to fade away");
  504. dots();
  505. Thread.sleep(1950);
  506. System.out.println("And you lose all thought.");
  507. conclusion();
  508. intro();
  509. } else {
  510. System.out.println("Unknown command registered!");
  511. puzzle3a();
  512. }
  513. } else {
  514. System.out.println("Unknown command registered!");
  515. puzzle3a();
  516. }
  517. }
  518. public static void conclusion() throws InterruptedException{
  519. System.out.println("You have completed the escape room!");
  520. Thread.sleep(1950);
  521. System.out.println("Congratulations!");
  522. Thread.sleep(1950);
  523. System.out.println("Type 'wake' to wake up!");
  524. Scanner console = new Scanner(System.in);
  525. String command = console.next();
  526. if (command.equalsIgnoreCase("wake")) {
  527. intro();
  528. } else {
  529. System.out.println("Unknown command registered!");
  530. conclusion();
  531. }
  532. }
  533. public static void dots() throws InterruptedException{
  534. System.out.print(".");
  535. Thread.sleep(950);
  536. System.out.print(".");
  537. Thread.sleep(950);
  538. System.out.println(".");
  539. }
  540. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement