Pen Settings



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


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


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.


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.



    <title>RPG GAME</title>
    <link rel="stylesheet" href="" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link href="|Candal|Permanent+Marker|Raleway:500|Reem+Kufi" rel="stylesheet">

    <style type="text/css">
    body {
        background-color: teal;
    p {
        font-family: 'Candal', sans-serif;
    .jumbotron h1 {
        color: #ccc;
    .jumbotron {
        background-color: transparent;
    h2 {
        font-size: 25px;
        color: #ccc;
    p {
        color: #ccc;
        font-size: 20px;
    <div class="jumbotron">
        <div class="container block-center">
            <h1> Welcome to the Rock, Paper, Scissors game!</h1>
            <h2>Press r, p or s to start playing</h2>
    <div class="container">
        <div id="game">
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="">
    <script src="" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    <script type="text/javascript">
    //sets the computer choices
    var computerChoices = ['r', 'p', 's'];

    //Declates the tallies to 0
    var wins = 0;
    var losses = 0;
    var ties = 0;

    // When the user presses the key it records the keypress and then sets it to userguess
    document.onkeyup = function(event) {
        var userGuess = String.fromCharCode(event.keyCode).toLowerCase();

        //This sets what the computer's guess is and it is equal to a random guess
        var computerGuess = computerChoices[Math.floor(Math.random() * computerChoices.length)];

        if ((userGuess === 'r') || (userGuess === 'p') || (userGuess === 's')) {

            // All win scenarios
            if ((userGuess === 'r') && (computerGuess === 's')) {
            } else if ((userGuess === 'p') && (computerGuess === 'r')) {
            } else if ((userGuess === 's') && (computerGuess === 'p')) {
            // All of the losses
            else if ((userGuess === 'r') && (computerGuess === 'p')) {
            } else if ((userGuess === 'p') && (computerGuess === 's')) {
            } else if ((userGuess === 's') && (computerGuess === 'r')) {
            // Tie scenarios
            else if (userGuess === computerGuess) {
            // Taking the tallies and displaying them in HTML
            var html = "<p>wins: " +
                wins +
                "</p>" +
                "<p>losses: " +
                losses +
                "</p>" +
                "<p>ties: " +
                ties +

            // Placing the html into the game ID
            document.querySelector('#game').innerHTML = html;