B. User Manual

The game is started by displaying all of the background information and the rules of the game in the command window, the interface in which the game is played and the information is given.  This is done by using a command called fprintf which allows any text to be displayed in the command window when executed.

Variables used for making the game work in loops and item identification like the key, paper, and desk under clock are set equal to one, also known as indexing. The main loop that the game is centered around is a while loop where as long as the variable in the while loop stays satisfied, the loop will not end.

The menu commands in the game are set equal to a variable so when an option in a menu is selected, the location of the option in the menu is set equal to the variable (1st option = 1, 2nd option = 2 etc). When an option in the menu is selected, if text or another menu was needed to be displayed,  if-elseif statements would be used. if-elseif statements can evaluate given commands when a condition it is paired with is true. So when the variable of the menu command = 1 (the 1st option was selected by the player), and is paired with an if statement, the commands under the if statement are evaluated when the first option is selected by the player.  If the 2nd option was selected by the player, the commands under the elseif statement are evaluated.

Given this foundation, the game is composed of a system of menus. As the player selects routes they wish to take in the game, different outcomes occur. The game can end either by dying, escaping the room, or quitting by entering Ctrl+C [a]. During the game,  the player is able to input a combination [b]. If the player inputs the combination correctly, they receive a key they can use to escape the room. If the player inputs the combination incorrectly, he/she dies and the game is over.

Overall, the code of the game consists of one big while loop that has branches of if-elseif statements and other while loops. Nested in these statements are fprintf commands, input commands, and error commands that provided information about what happens in the game and adds to the overall effect of the gameplay.

[a] When the error command is used in Escape the Room, it ends the game by prompting an error in MATLAB and displaying ‘game over’.  It is used when the player dies and has to restart or when the player wins by opening the door with the key.

[b]The input command is used in Escape the Room when the player selects the menu option to enter a combination. In the command window, there is text that is displayed explaining how to enter in the combination.