Advertisement
Guest User

Untitled

a guest
Nov 16th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.19 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class EscapeRoom{
  3. public static String password = "password";
  4. public static String userName = "";
  5. public static void main(String[] args) throws InterruptedException{
  6. Scanner console = new Scanner(System.in);
  7. //intro();
  8. userName = getUsername();
  9. description();
  10. puzzle0();
  11. String input = console.nextLine();
  12.  
  13. while(!input.equalsIgnoreCase("Quit")){
  14. input = console.nextLine();
  15. }
  16. }
  17. public static void intro() throws InterruptedException{
  18. System.out.println("As you gradually open your eyes, you realize ");
  19. Thread.sleep(2300);
  20. System.out.println("you are in Mr.Binz' AP Java classroom.");
  21. Thread.sleep(2300);
  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. }
  37. public static String getUsername() throws InterruptedException{
  38. Scanner console = new Scanner(System.in);
  39. Thread.sleep(750);
  40. System.out.println("▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬");
  41. Thread.sleep(750);
  42. System.out.println("Enter a username: ");
  43. String name = console.next();
  44. Thread.sleep(750);
  45. System.out.println("Welcome to the Escape Room");
  46. System.out.println("\t" + name);
  47. Thread.sleep(500);
  48. System.out.println("");
  49. Thread.sleep(500);
  50. System.out.println("Enter 'quit' to quit");
  51. Thread.sleep(750);
  52. System.out.println("▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬");
  53. Thread.sleep(750);
  54. System.out.println("");
  55. return name;
  56. }
  57. public static void description() throws InterruptedException{
  58. Thread.sleep(950);
  59. System.out.println("Suddenly the TV flickers to life!");
  60. Thread.sleep(1900);
  61. System.out.print("Behind a wall of static, you notice a figure");
  62. dots();
  63. Thread.sleep(2350);
  64. System.out.println("▬[Mr Binz]▬▬▬▬▬▬▬▬▬▬▬▬ ");
  65. System.out.println("Hello there, " + userName );
  66. Thread.sleep(750);
  67. System.out.println("It seems like you have awoken. ");
  68. Thread.sleep(750);
  69. System.out.println("You're currently in room 334 taking part in my little expirement.");
  70. Thread.sleep(750);
  71. System.out.println(" To get out of my room, ");
  72. Thread.sleep(750);
  73. System.out.println("you will need to solve a series of puzzles.");
  74. Thread.sleep(750);
  75. System.out.println("Good luck, player");
  76. System.out.println("▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ ");
  77. Thread.sleep(700);
  78. System.out.println("Suddenly, the TV blacks out!");
  79. Thread.sleep(700);
  80. System.out.println("Hint: Use 'observe' to look around");
  81. }
  82. public static void puzzle0() throws InterruptedException{
  83. Scanner console = new Scanner(System.in);
  84. String command = console.next();
  85. if (command.equalsIgnoreCase("observe")) {
  86. System.out.println("It seems like the same computer room you come");
  87. Thread.sleep(2250);
  88. System.out.println("to everyday. In the vicinity you see the SHELF,");
  89. Thread.sleep(2250);
  90. System.out.print("COMPUTERS, DOOR, and a TV");
  91. dots();
  92. System.out.println("Why don't you 'look' around?(Hint:look object)");
  93. puzzle1();
  94. } else if(!command.equalsIgnoreCase("observe")) {
  95. System.out.println("Unknown command registered!");
  96. System.out.println("Hint: Use 'observe' to look around");
  97. puzzle0();
  98. }
  99. }
  100. public static void puzzle1() throws InterruptedException{
  101. Scanner console = new Scanner(System.in);
  102. String command = console.next();
  103. String object = console.next();
  104. if (command.equalsIgnoreCase("look")) {
  105. if (object.equalsIgnoreCase("shelf")) {
  106. System.out.print("There seems to be a few MUGS and BINDERS");
  107. dots();
  108. Thread.sleep(2500);
  109. System.out.println("Suddenly, you feel a breeze coming from behind the shelf!");
  110. Thread.sleep(800);
  111. System.out.println("What will you do?");
  112. puzzle1a();
  113. } else if (object.equalsIgnoreCase("computers")) {
  114. System.out.print("You walk over to the computer and power it on");
  115. dots();
  116. Thread.sleep(1950);
  117. System.out.println("It looks like its locked!");
  118. Thread.sleep(1950);
  119. System.out.println("It needs a password");
  120. puzzle1();
  121. } else if (object.equalsIgnoreCase("door")) {
  122. System.out.println("You walk over to the door and try the handle.");
  123. Thread.sleep(1950);
  124. System.out.println("It seems to be locked!");
  125. Thread.sleep(1950);
  126. System.out.print("You peek out the windows, into the hallway");
  127. dots();
  128. Thread.sleep(1950);
  129. System.out.println("It's too dark to notice anything.");
  130. Thread.sleep(1950);
  131. System.out.println("As you take a step back, you notice a protruding keyhole,");
  132. System.out.println("under the handle.");
  133. puzzle1();
  134. } else if (object.equalsIgnoreCase("tv")) {
  135. System.out.println("You walk over to the tv.");
  136. Thread.sleep(1950);
  137. System.out.print("It seems like an old box tv");
  138. dots();
  139. System.out.println("Several BUTTONs seem to be lining the bottom.");
  140. System.out.println("It seems be within a 'push' distance!");
  141. puzzle1e();
  142. }
  143. }
  144. }
  145. public static void puzzle1e() throws InterruptedException{
  146. Scanner console = new Scanner(System.in);
  147. String command = console.next();
  148. String object = console.next();
  149. if (command.equalsIgnoreCase("push")) {
  150. if (object.equalsIgnoreCase("button")) {
  151. System.out.println("You push the power button on the TV.");
  152. Thread.sleep(1950);
  153. System.out.println("Nothing seems to happen.");
  154. Thread.sleep(1950);
  155. System.out.println("You try the other buttons.");
  156. Thread.sleep(1950);
  157. System.out.print("It seems to be dead");
  158. dots();
  159. puzzle1();
  160. }
  161. }
  162. }
  163. public static void puzzle1a() throws InterruptedException{
  164. System.out.println("Hint: There seems to be something behind the SHELF!");
  165. Thread.sleep(2250);
  166. System.out.print(" Maybe you can 'push' it out of the way");
  167. dots();
  168. Scanner console = new Scanner(System.in);
  169. String command = console.next();
  170. String object = console.next();
  171. if (command.equalsIgnoreCase("push")) {
  172. System.out.println("You push the shelf to find a dark, dusty room");
  173. Thread.sleep(2250);
  174. System.out.println("Within it, a lone table stands");
  175. Thread.sleep(2250);
  176. System.out.println("You see a thick BOOK sitting on top of it");
  177. puzzle1b();
  178. } //else if(commad.equalsIgnoreCase("look")) {
  179. //}
  180. else if(!command.equalsIgnoreCase("push")) {
  181. System.out.println("Unknown command registered!");
  182. Thread.sleep(2250);
  183. System.out.println("Hint: There seems to be something behind the shelf!");
  184. Thread.sleep(2250);
  185. System.out.print(" Maybe you can push it out of the way");
  186. dots();
  187. puzzle0();
  188. }
  189. }
  190. public static void puzzle1b() throws InterruptedException{
  191. Scanner console = new Scanner(System.in);
  192. String command = console.next();
  193. String object = console.next();
  194. if (command.equalsIgnoreCase("look")) {
  195. if (object.equalsIgnoreCase("book")){
  196. System.out.println("You lift the heavy cover of the book and wipe off the coat of dust.");
  197. Thread.sleep(1950);
  198. System.out.println("On the cover it reads 'AP Java Class of 11111001011'"); //1995
  199. System.out.println("As you begin to flip through the pages, you see the names and pictures of several students,");
  200. System.out.println("who you don't recognize. Suddenly, a note falls to the ground.");
  201. System.out.println("Dear Nathan, 19th Birthday. Congrats on your graduation."); //happy birthday note. August 19 1976 from sidechar1 name later
  202. System.out.println("Hopefully you had a good 2 months off of school. I'm sending this on the 14th because");
  203. System.out.println("it usually takes around 5 days for my mail to get to you. Hopefully you get this on your");
  204. System.out.println("birthday. From sidechar1.");
  205. //puzzle1c();
  206. }
  207. }
  208. }
  209. public static void dots() throws InterruptedException{
  210. System.out.print(".");
  211. Thread.sleep(575);
  212. System.out.print(".");
  213. Thread.sleep(575);
  214. System.out.println(".");
  215. }
  216. }
  217. /*
  218. Locations:
  219. Shelf
  220. Computers
  221. Door
  222.  
  223. Objects:
  224. Mugs
  225. Books
  226.  
  227. Commands:
  228. Move
  229. Push
  230. Look
  231. Observe
  232.  
  233.  
  234. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement