Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.40 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. puzzle1();
  91. } else if(!command.equalsIgnoreCase("observe")) {
  92. System.out.println("Unknown command registered!");
  93. puzzle0();
  94. }
  95. }
  96. public static void puzzle1() throws InterruptedException{
  97. System.out.println("It seems like the same computer room you come");
  98. Thread.sleep(2250);
  99. System.out.println("to everyday. In the vicinity you see the SHELF,");
  100. Thread.sleep(2250);
  101. System.out.print("COMPUTERS, DOOR, and a TV");
  102. dots();
  103. System.out.println("Why don't you 'look' around?");
  104. System.out.println("Hint: 'look' OBJECT");
  105. Scanner console = new Scanner(System.in);
  106. String command = console.next();
  107. String object = console.next();
  108. if (command.equalsIgnoreCase("look")) {
  109. if (object.equalsIgnoreCase("shelf")) {
  110. System.out.print("There seems to be a few MUGS and BINDERS");
  111. dots();
  112. Thread.sleep(2500);
  113. System.out.println("Suddenly, you feel a breeze coming from behind the shelf!");
  114. Thread.sleep(800);
  115. System.out.println("What will you do?");
  116. puzzle1a();
  117. } else if (object.equalsIgnoreCase("computers")) {
  118. System.out.print("You walk over to the computer and power it on");
  119. dots();
  120. Thread.sleep(1950);
  121. System.out.println("It looks like its locked!");
  122. Thread.sleep(1950);
  123. System.out.println("It needs a password");
  124. puzzle1();
  125. } else if (object.equalsIgnoreCase("door")) {
  126. System.out.println("You walk over to the door and try the handle.");
  127. Thread.sleep(1950);
  128. System.out.println("It seems to be locked!");
  129. Thread.sleep(1950);
  130. System.out.print("You peek out the windows, into the hallway");
  131. dots();
  132. Thread.sleep(1950);
  133. System.out.println("It's too dark to notice anything.");
  134. Thread.sleep(1950);
  135. System.out.println("As you take a step back, you notice a protruding keyhole,");
  136. System.out.println("under the handle.");
  137. puzzle1();
  138. } else if (object.equalsIgnoreCase("tv")) {
  139. System.out.println("You walk over to the tv.");
  140. Thread.sleep(1950);
  141. System.out.print("It seems like an old box tv");
  142. dots();
  143. System.out.println("Several BUTTONs seem to be lining the bottom.");
  144. System.out.println("It seems be within a 'push' distance!");
  145. puzzle1e();
  146. }
  147. }
  148. }
  149. public static void puzzle1e() throws InterruptedException{
  150. Scanner console = new Scanner(System.in);
  151. String command = console.next();
  152. String object = console.next();
  153. if (command.equalsIgnoreCase("push")) {
  154. if (object.equalsIgnoreCase("button")) {
  155. System.out.println("You push the power button on the TV.");
  156. Thread.sleep(1950);
  157. System.out.println("Nothing seems to happen.");
  158. Thread.sleep(1950);
  159. System.out.println("You try the other buttons.");
  160. Thread.sleep(1950);
  161. System.out.print("It seems to be dead");
  162. dots();
  163. puzzle1();
  164. }
  165. }
  166. }
  167. public static void puzzle1a() throws InterruptedException{
  168. System.out.println("Hint: There seems to be something behind the SHELF!");
  169. Thread.sleep(2250);
  170. System.out.print(" Maybe you can 'push' it out of the way");
  171. dots();
  172. Scanner console = new Scanner(System.in);
  173. String command = console.next();
  174. String object = console.next();
  175. if (command.equalsIgnoreCase("push")) {
  176. System.out.println("You push the shelf to find a dark, dusty room");
  177. Thread.sleep(2250);
  178. System.out.println("Within it, a lone table stands");
  179. Thread.sleep(2250);
  180. System.out.println("You see a thick BOOK sitting on top of it");
  181. puzzle1b();
  182. } else if(command.equalsIgnoreCase("observe")) {
  183. puzzle1();
  184. } else if(!command.equalsIgnoreCase("push")) {
  185. System.out.println("Unknown command registered!");
  186. Thread.sleep(1650);
  187. System.out.println("Hint: Use 'observe' to look around again.");
  188. Thread.sleep(1650);
  189. puzzle1a();
  190. }
  191. }
  192. public static void puzzle1b() throws InterruptedException{
  193. System.out.println("You lift the heavy cover of the book and wipe off the coat of dust.");
  194. Thread.sleep(1950);
  195. System.out.println("On the cover it reads 'AP Java Class of 11111001011'"); //1995
  196. Thread.sleep(1950);
  197. System.out.println("As you begin to flip through the pages, you see the names and pictures of several students,");
  198. Thread.sleep(1950);
  199. System.out.println("who you don't recognize. Suddenly, a note falls to the ground.");
  200. Thread.sleep(1950);
  201. System.out.println("Dear Nathan, 19th Birthday. Congrats on your graduation."); //happy birthday note. August 19 1976 from sidechar1 name later
  202. Thread.sleep(1950);
  203. System.out.println("Hopefully you had a good 2 months off of school. I'm sending this on the 14th because");
  204. Thread.sleep(1950);
  205. System.out.println("it usually takes around 5 days for my mail to get to you. Hopefully you get this on your");
  206. Thread.sleep(1950);
  207. System.out.println("birthday. From /-==-");
  208. dots();
  209. Thread.sleep(1650);
  210. System.out.println("The name is too faded to make out.");
  211. Thread.sleep(1750);
  212. System.out.println("Hint: 'Look' somewhere else!");
  213. puzzle1c();
  214. }
  215. public static void puzzle1c() throws InterruptedException{
  216. Scanner console = new Scanner(System.in);
  217. String command = console.next();
  218. String object = console.next();
  219. if (command.equalsIgnoreCase("look")) {
  220. if (object.equalsIgnoreCase("shelf")) {
  221. System.out.print("There seems to be a few MUGS and BINDERS");
  222. dots();
  223. Thread.sleep(2500);
  224. System.out.println("You have already searched this room, ");
  225. Thread.sleep(1500);
  226. System.out.println("would you like to look through it again?");
  227. puzzle1f();
  228. } else if (object.equalsIgnoreCase("computers")) {
  229. System.out.print("You walk over to the computer and power it on");
  230. dots();
  231. Thread.sleep(1950);
  232. System.out.println("On the bottom right corner a notification pops up");
  233. Thread.sleep(1950);
  234. System.out.println("The screen prompts for a password");
  235. Thread.sleep(1950);
  236. System.out.print("Underneath the password prompt, you can make out some small text");
  237. dots();
  238. Thread.sleep(1950);
  239. System.out.println("Passwords have been reset. Use PwMMDDYYYY as your passwords!");
  240. puzzle1g();
  241. } else if (object.equalsIgnoreCase("door")) {
  242. System.out.println("You walk over to the door and try the handle.");
  243. Thread.sleep(1950);
  244. System.out.println("It seems to be locked!");
  245. Thread.sleep(1950);
  246. System.out.print("You peek out the windows, into the hallway");
  247. dots();
  248. Thread.sleep(1950);
  249. System.out.println("It's too dark to notice anything.");
  250. Thread.sleep(1950);
  251. System.out.println("As you take a step back, you notice a protruding keyhole,");
  252. System.out.println("under the handle.");
  253. puzzle1c();
  254. } else if (object.equalsIgnoreCase("tv")) {
  255. System.out.println("You walk over to the tv.");
  256. Thread.sleep(1950);
  257. System.out.print("It seems like an old box tv");
  258. dots();
  259. puzzle1c();
  260. }
  261. }
  262. }
  263. public static void puzzle1f() throws InterruptedException{
  264. Scanner console = new Scanner(System.in);
  265. String command = console.next();
  266. if(command.equalsIgnoreCase("yes")) {
  267. puzzle1b();
  268. }else if(command.equalsIgnoreCase("no")) {
  269. puzzle1c();
  270. }
  271. }
  272. public static void puzzle1g() throws InterruptedException{
  273. System.out.println("Enter a Password: ");
  274. Scanner console = new Scanner(System.in);
  275. String password = console.next();
  276. if(password.equals("Pw08191976")) {
  277. System.out.println("The computer opened");
  278. Thread.sleep(1650);
  279. System.out.println("A title named 'Subjects' is open");
  280. Thread.sleep(1650);
  281. System.out.println("They are logs describing the past escape room experiment.");
  282. Thread.sleep(1650);
  283. System.out.println("One particularly pops out, ");
  284. Thread.sleep(1650);
  285. System.out.println("There seems to be a note written on the side");
  286. Thread.sleep(1650);
  287. System.out.println("Test Subject 7, displayed erratice behavior before he loses consciousness");
  288. Thread.sleep(1650);
  289. System.out.println("He writes on the wall that 'the key is in the room'.");
  290. Thread.sleep(1650);
  291. System.out.println("The screen blacks out and the TV flickers back to life again!");
  292. puzzle2();
  293. }else if(password.equalsIgnoreCase("Logout")) {
  294. puzzle1c();
  295. } else {
  296. System.out.println("Wrong password");
  297. Thread.sleep(750);
  298. System.out.println("Enter 'logout' to return to the room");
  299. puzzle1g();
  300. }
  301. }
  302. public static void puzzle2() throws InterruptedException{
  303. System.out.println("▬[Mr Binz]▬▬▬▬▬▬▬▬▬▬▬▬ ");
  304. Thread.sleep(1750);
  305. System.out.println("So, " + userName );
  306. Thread.sleep(1750);
  307. System.out.println("It seems like you found some old experiment logs.");
  308. Thread.sleep(1750);
  309. System.out.println("However, I will congradulate you. None of the other");
  310. Thread.sleep(1750);
  311. System.out.println("test subjects have performed as brilliantly as you did.");
  312. Thread.sleep(1750);
  313. System.out.println("But like the rest of them, you will never escape this");
  314. Thread.sleep(1750);
  315. System.out.println("room.");
  316. Thread.sleep(1750);
  317. System.out.println("▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ ");
  318. Thread.sleep(1750);
  319. System.out.println("The screen abruptly turns off and leaves the room in silence");
  320. puzzle2a();
  321. }
  322. public static void puzzle2a() throws InterruptedException{
  323. System.out.println("You stare at the empty screen in silence.");
  324. System.out.println("Hint: Use 'look' to observe the SHELF, MUGS, COMPUTERS, and DOOR");
  325. Scanner console = new Scanner(System.in);
  326. String command = console.next();
  327. String object = console.next();
  328. if (command.equalsIgnoreCase("look")) {
  329. if (object.equalsIgnoreCase("shelf")) {
  330. System.out.print("There seems to be a few MUGS and BINDERS");
  331. dots();
  332. Thread.sleep(2500);
  333. System.out.println("You have already searched this room, ");
  334. Thread.sleep(1500);
  335. System.out.println("would you like to look through it again?");
  336. puzzle2a();
  337. } else if (object.equalsIgnoreCase("computers")) {
  338. System.out.print("You walk over to the computer and power it on");
  339. dots();
  340. Thread.sleep(1950);
  341. System.out.println("The screen is still black");
  342. Thread.sleep(1950);
  343. puzzle2a();
  344. } else if (object.equalsIgnoreCase("door")) {
  345. System.out.println("You walk over to the door and try the handle.");
  346. Thread.sleep(1950);
  347. System.out.println("It seems to be locked!");
  348. Thread.sleep(1950);
  349. System.out.print("You peek out the windows, into the hallway");
  350. dots();
  351. Thread.sleep(1950);
  352. System.out.println("It's too dark to notice anything.");
  353. Thread.sleep(1950);
  354. System.out.println("As you take a step back, you notice a protruding keyhole,");
  355. System.out.println("under the handle.");
  356. puzzle2a();
  357. } else if (object.equalsIgnoreCase("tv")) {
  358. System.out.println("You walk over to the tv.");
  359. Thread.sleep(1950);
  360. System.out.print("It seems like an old box tv");
  361. dots();
  362. puzzle2a();
  363. } else if (object.equalsIgnoreCase("binders")) {
  364. System.out.println("You take a look in the binders.");
  365. Thread.sleep(1950);
  366. System.out.print("There seems to be several school documents inside");
  367. dots();
  368. Thread.sleep(1950);
  369. System.out.println("None of them seem to be very important.");
  370. puzzle2a();
  371. } else if (object.equalsIgnoreCase("mugs")) {
  372. System.out.println("You take ahold of a mug and look inside.");
  373. Thread.sleep(1950);
  374. System.out.println("Even in the dark room, you can notice a small glint inside.");
  375. Thread.sleep(1950);
  376. System.out.print("You reach in and pull out a KEY");
  377. dots();
  378. Thread.sleep(1950);
  379. System.out.println("You take the key and put it in your back pocket.");
  380. puzzle3();
  381. }
  382. }
  383. }
  384. public static void puzzle3() throws InterruptedException{
  385. Scanner console = new Scanner(System.in);
  386. String command = console.next();
  387. String object = console.next();
  388. if (command.equalsIgnoreCase("look")) {
  389. if (object.equalsIgnoreCase("shelf")) {
  390. System.out.print("There seems to be a few MUGS and BINDERS");
  391. dots();
  392. Thread.sleep(2500);
  393. System.out.println("You have already searched this room, ");
  394. Thread.sleep(1500);
  395. System.out.println("would you like to look through it again?");
  396. puzzle3();
  397. } else if (object.equalsIgnoreCase("computers")) {
  398. System.out.print("You walk over to the computer and power it on");
  399. dots();
  400. Thread.sleep(1950);
  401. System.out.println("The screen is still black");
  402. Thread.sleep(1950);
  403. puzzle3();
  404. } else if (object.equalsIgnoreCase("door")) {
  405. System.out.println("You walk over to the door and try the handle.");
  406. Thread.sleep(1950);
  407. System.out.println("It seems to be locked!");
  408. Thread.sleep(1950);
  409. System.out.print("You peek out the windows, into the hallway");
  410. dots();
  411. Thread.sleep(1950);
  412. System.out.println("It's too dark to notice anything.");
  413. Thread.sleep(1950);
  414. System.out.println("As you take a step back, you notice a protruding keyhole,");
  415. System.out.println("under the handle.");
  416. Thread.sleep(1950);
  417. System.out.println("You might be able to 'use' the KEY!");
  418. puzzle3a();
  419. } else if (object.equalsIgnoreCase("tv")) {
  420. System.out.println("You walk over to the tv.");
  421. Thread.sleep(1950);
  422. System.out.print("It seems like an old box tv");
  423. dots();
  424. puzzle3();
  425. } else if (object.equalsIgnoreCase("binders")) {
  426. System.out.println("You take a look in the binders.");
  427. Thread.sleep(1950);
  428. System.out.print("There seems to be several school documents inside");
  429. dots();
  430. Thread.sleep(1950);
  431. System.out.println("None of them seem to be very important.");
  432. puzzle3();
  433. } else if (object.equalsIgnoreCase("mugs")) {
  434. System.out.println("You take ahold of a mug and look inside.");
  435. Thread.sleep(1950);
  436. System.out.println("There doesn't seem to be anything inside.");
  437. Thread.sleep(1950);
  438. System.out.print("You put it back in place.");
  439. puzzle3();
  440. }
  441. }
  442. }
  443. public static void puzzle3a() throws InterruptedException{
  444. Scanner console = new Scanner(System.in);
  445. String command = console.next();
  446. String object = console.next();
  447. if (command.equalsIgnoreCase("use")) {
  448. if (object.equalsIgnoreCase("key")) {
  449. System.out.println("You reach into your pocket and pull out a key.");
  450. Thread.sleep(1950);
  451. System.out.print("You start inserting the key into the lock");
  452. dots();
  453. Thread.sleep(1750);
  454. System.out.println("To your surprise, it slides into place with a click.");
  455. Thread.sleep(2450);
  456. System.out.println("You slowly turn the key and you hear the bolt retract.");
  457. Thread.sleep(1950);
  458. System.out.println("As you push the door open and walk out into a long open hallway");
  459. Thread.sleep(1950);
  460. System.out.println("you notice that the hallway looks strange,");
  461. Thread.sleep(1950);
  462. System.out.print("like it's spinning");
  463. dots();
  464. Thread.sleep(1950);
  465. System.out.println("You fall to your knees and the edges of your vision begin to darken!");
  466. Thread.sleep(1950);
  467. System.out.print("You can feel your conciousness begining to fade away");
  468. dots();
  469. Thread.sleep(1950);
  470. System.out.println("And you lose all thought.");
  471. conclusion();
  472. intro();
  473. }
  474. }
  475. }
  476. public static void conclusion() throws InterruptedException{
  477. System.out.println("You have completed the escape room!");
  478. Thread.sleep(1950);
  479. System.out.println("Congratulations!");
  480. Thread.sleep(1950);
  481. System.out.println("Type 'wake' to wake up!");
  482. Scanner console = new Scanner(System.in);
  483. String command = console.next();
  484. if (command.equalsIgnoreCase("wake")) {
  485. intro();
  486. }
  487. }
  488. public static void dots() throws InterruptedException{
  489. System.out.print(".");
  490. Thread.sleep(575);
  491. System.out.print(".");
  492. Thread.sleep(575);
  493. System.out.println(".");
  494. }
  495. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement