Skip to content

Instantly share code, notes, and snippets.

@mknepprath
Created January 25, 2016 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mknepprath/96b9944d055de23345ee to your computer and use it in GitHub Desktop.
Save mknepprath/96b9944d055de23345ee to your computer and use it in GitHub Desktop.
var position = "start";
var response = "";
$( "#tweet" ).click(function() {
var tweet = $('#move').val();
var move = $('#move').val().toLowerCase().replace(/[.,-\/#!$%\^&\*;:{}=\-_`~()]/g,"");
if (position === "start") {
if (move === "start") {
position = "cell";
response = "You wake up in an unfamiliar room.";
}
else {
response = "You can't do that."
}
}
else if (position === "cell") {
if (move === "look at room") {
response = "Typical room, four walls, one is made of bars."
}
else if (move === "look at walls") {
response = "There’s a front wall with bars, back, left, and right wall. That front wall looks pretty interesting."
}
else if (move === "look at front wall") {
response = "There’s a door, and through the bars you see a trail of large ants and a key on the floor out of reach."
}
else if (move === "look at right wall") {
response = "There’s a window with a floor on the sill."
}
else if (move === "look at window" || move === "look through window" || move === "look out window") {
response = "There's a dense forest. You can see a blue bird tweeting."
}
else if (move === "open door" || move === "open the door") {
response = "Surprise, no can do."
}
else if (move === "pick up ants" || move === "pick up ant" || "pick up an ant") {
response = "They bite you. You drop it."
}
else if (move === "go through window") {
response = "You are much larger than the window."
}
else {
response = "You can't do that."
}
}
else {
response = "You should not be here."
};
$( ".command" ).prepend( "<li class='list-group-item' data-position='" + position + "'>@mknepprath " + tweet + "</li>" );
$( ".command" ).prepend( "<li class='list-group-item list-group-item-info'>@familiarlilt " + response + "</li>" );
$('#move').val('');
});
$( "#reset" ).click(function() {
location.reload();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment