Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                function end() {
  alert("The end.");
}

function free () {
  
  
  do {
      incorrect = false;
    var choice = prompt("You attempt to free yourself.... and succeed! You hear footsteps... Do you wait to see who is coming [C]? Run for your life [R]? Do you hide [H]?");
    if(choice == "C")
      {
        alert("After " + (Math.floor(Math.random() * 30) + 1) + " seconds, the footsteps stop... You walk forward to investigate, where a trap door opens and you fall through to your demise.");
      }
    else if (choice == "R")
      {
        alert("You bolt out the door, running as fast as you can before... You made it out of the building. You look back as your running, but to your dismay there is no building behind you.");
      }
    else if (choice == "H")
      {
        alert("You hide under the bed... The footsteps stop. You wait a while before peering out from under the bead to see " + (Math.floor(Math.random() * 15) + 2) + " figures standing in front of you. One reaches down and you fall unconsious...");
      }
    else {
      incorrect = true; 
      alert("Invalid response.");
    }
    } while (incorrect == true);
  
  end();
}

function scream()
{
  var num = prompt("How many times do you want to scream?");
  var screaming = "";
  for(var i = 0; i< num; i++){
    screaming += "You scream for help...\n";
  }
  alert(screaming + "No one comes...");
  end();
}



name = prompt("What is your name?");
if(confirm("Are you ready to play?"))
  {
    do {
      incorrect = false;
    var choice = prompt("You wake up handcuffed to a pipe... \"Where am I? What happened?\" you mutter to yourself. Do you try to free yourself [F] or do you scream for help [S]?");
    if(choice == "F")
      {
        free();
      }
    else if (choice == "S")
      {
        scream();
      }
    else {
      incorrect = true; 
      alert("Invalid response.");
    }
    } while (incorrect == true);
  }
else {
  alert("Maybe next time.");
}
              
            
!
999px

Console