Skip to content

Instantly share code, notes, and snippets.

@Pugio
Created December 10, 2014 13:56
Show Gist options
  • Save Pugio/16dd0a0f8ece7d506ac5 to your computer and use it in GitHub Desktop.
Save Pugio/16dd0a0f8ece7d506ac5 to your computer and use it in GitHub Desktop.
Text based adventure.
// set up the rooms/scenes
var Prompts = { A: "You are in room A. The doors are B, C.",
B: "You are in room B. The doors are A, D.",
C: "You are in room C. The doors are A, D.",
D: "You are in room D. The doors are B, C."
};
// start here
var response = prompt(Prompts['A']);
while (response != "X") {
response = prompt(Prompts[response]);
}
alert("You have been eaten by a Grue!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment