Advertisement
Guest User

Untitled

a guest
Jan 26th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
COBOL 2.61 KB | None | 0 0
  1. IDENTIFICATION DIVISION.
  2.  
  3. PROGRAM-ID. HELLO-WORLD.
  4.  
  5. DATA DIVISION.
  6.  
  7.     WORKING-STORAGE SECTION.
  8.  
  9.         01 UNOS PIC X(100).
  10.  
  11.     77 HASKEY PIC 9 VALUE ZERO.
  12.  
  13. PROCEDURE DIVISION.
  14. HALLWAY.
  15. DISPLAY "You are in a hallway with four alcoves.".
  16.  
  17. DISPLAY "Exits: N S E W .".
  18.  
  19. DISPLAY "What should I do?>" WITH NO ADVANCING.
  20.    
  21. ACCEPT UNOS FROM CONSOLE.
  22.    
  23. EVALUATE UNOS
  24.    
  25. WHEN "N"
  26.    
  27. PERFORM OFFICE1
  28.    
  29. WHEN "S"
  30.    
  31. PERFORM OFFICE2
  32.    
  33. WHEN "W"
  34.    
  35. PERFORM LOBBY
  36.    
  37. WHEN "E"
  38.    
  39. PERFORM RESTROOM.
  40.    
  41. WHEN OTHER
  42.    
  43. DISPLAY "I don't understand."
  44.    
  45. GO TO HALLWAY.
  46.  
  47. END.
  48. STOP RUN.
  49.  
  50.  
  51. OFFICE1.
  52.  
  53. DISPLAY "You are in an office. A terminal screen is turned on. You can see it's night out of the window".
  54.  
  55. DISPLAY "You see nothing else of interest".
  56.  
  57. DISPLAY "Exits: S.".
  58.  
  59. DISPLAY "What should I do?>" WITH NO ADVANCING.
  60.  
  61. ACCEPT UNOS FROM CONSOLE.
  62. EVALUATE UNOS
  63. WHEN "S"
  64. GO TO HALLWAY
  65. WHEN "EXAMINE TERMINAL"
  66. DISPLAY "You see a notes application open with: 'Dobbs left the key to the main door at the security desk.' written on it."
  67. GO TO OFFICE2
  68. WHEN OTHER
  69. DISPLAY "I don't understand"
  70. GO TO OFFICE1.
  71.  
  72. OFFICE2.
  73. DISPLAY "You are in the executive office. There is a fax machine on the table and a paper sticking out of it.".
  74. DISPLAY "You see nothing else of interest.".
  75. DISPLAY "Exits: N".
  76. DISPLAY "What should I do?>" WITH NO ADVANCING.
  77.  
  78. ACCEPT UNOS FROM CONSOLE.
  79. EVALUATE UNOS
  80. WHEN "N"
  81. GO TO HALLWAY
  82. WHEN "EXAMINE PAPER"
  83. DISPLAY "'TO: Jane DeSoto , MSG: Safe code is Djura777'."
  84. GO TO OFFICE2
  85. WHEN OTHER
  86. DISPLAY "I don't understand."
  87. GO TO OFFICE2.
  88.  
  89. RESTROOM.
  90. DISPLAY "The restroom is spotless clean, except for a grafitti written on the wall 'KILROY WAS HERE.'.".
  91. DISPLAY "You see nothing else of interest.".
  92. DISPLAY "Exits: W".
  93. DISPLAY "What should I do?>" WITH NO ADVANCING.
  94.  
  95. ACCEPT UNOS FROM CONSOLE.
  96. EVALUATE UNOS
  97. WHEN "W"
  98. GO TO HALLWAY
  99. WHEN OTHER
  100. DISPLAY "I don't understand."
  101. GO TO RESTROOM.
  102.  
  103. LOBBY.
  104. DISPLAY "You are in the lobby. There is a secuirty desk with a safe to the northern end, and the main door is to the west".
  105. DISPLAY "You see nothing else of interest.".
  106. DISPLAY "Exits: N".
  107. DISPLAY "What should I do?>" WITH NO ADVANCING.
  108.  
  109. ACCEPT UNOS FROM CONSOLE.
  110. EVALUATE UNOS
  111. WHEN "E"
  112. GO TO HALLWAY
  113. WHEN "OPEN SAFE"
  114. DISPLAY "Enter the code>" WITH NO ADVANCING
  115. ACCEPT UNOS FROM CONSOLE
  116. IF UNOS EQUALS "Djura777" THEN
  117. DISPLAY "You got the key!"
  118. DISPLAY "You sucessfully exit the building."
  119. DISPLAY "Game over! You won!"
  120. GO TO END.
  121.  
  122. ELSE
  123. DISPLAY "Wrong password!"
  124. GO TO LOBBY.
  125. WHEN OTHER
  126. DISPLAY "I don't understand."
  127. GO TO OFFICE2.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement