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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <center>
  <div><!--
    --><button>Account</button><!--
    --><button>Deposit</button><!--
    --><button>Withdraw</button>
  </div>
  <div><!--
    --><input type="text" placeholder="Bet Amount (BTC)"><!--
    --><button id="confirmBets">Confirm Bet</button><!--
    --><button id="clearBets">Clear Board</button>
  </div>
  <div id="gameBoard"></div>
  <div id="messageWindow"><!--
    --><button id="selected">Recent Bets</button><!--
    --><button>Chat Box</button><!--
    --><button>Hashes</button>
    <p>Splooge won 1 BTC</p>
    <p>Splooge won 1 BTC</p>
    <p>Splooge won 1 BTC</p>
    <p>Splooge won 1 BTC</p>
    <p>Splooge won 1 BTC</p>
  </div>
</center>
              
            
!

CSS

              
                * {
  font-family: tahoma;
  font-size: 16px;
  margin: 0;
  padding: 0;
}

table, tr, td {
  border-collapse: collapse;
}

td {
  text-align: center;
  width: 50px;
  height: 50px;
  transition: all .25s;
}

td:hover {
  box-shadow: inset 2px 2px 0 #aaa, inset -2px -2px 0 #aaa;
}
.playerBet {
  background: #aaf;
}

.playerBet:hover {
  box-shadow: inset 2px 2px 0 #00a, inset -2px -2px 0 #00a;
}

.killPoint {
  transition: background 2.0s ease-in;
  transition-delay: 3.5s;
  background: #faa;
}

.firstKillPoint {
  transition: background 3.0s;
  background: #faa;
}

.killPoint:hover {
  box-shadow: inset 2px 2px 0 #a00, inset -2px -2px 0 #a00;
}

.lostOn {
  background: #faf;
}

.lostOn:hover {
  box-shadow: inset 2px 2px 0 #a0a, inset -2px -2px 0 #a0a;
}

button {
  outline: 0;
  border: 0;
  background: #fff;
  color: #666;
  margin: 10px 5px;
  padding: 10px;
  width: 150px;
  transition: all .25s;
}

button:hover {
  box-shadow: inset 2px 2px 0 #aaa, inset -2px -2px 0 #aaa;
  color: #333;
}

#selected {
  color: #000;
}

#empty, #empty:hover, #empty:focus {
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #fff;
  color: #fff;
}

p {
  text-align: left;
  border-left: 2px solid #aaa;
  margin: 10px;
  padding: 10px;
  width: 450px;
  transition: all .25s;
}

p:hover {
  margin: 10px 10px 10px 20px;
  padding: 10px 10px 10px 20px;
}

input {
  outline: 0;
  border: 2px solid #aaa;
  margin: 10px;
  padding: 10px;
  width: 150px;
  transition: all .25s;
}

input:hover,input:focus {
  box-shadow: 0 0 2px #aaf;
  border: 3px solid #aaf;
}

::-webkit-input-placeholder {
   color: #aaa;
}

input[type="submit"] {
  background: #eee;
  width: 180px;
}

input[type="submit"]:hover, input[type="submit"]:focus {
  background: #eef;
}

a {
  text-decoration: none;
  color: #aaa;
  margin: 0 10px 0 0;
  transition: all .25s;
}

a:hover {
  color: #000;
}

#a {
  color: #aaf;
}
              
            
!

JS

              
                $(document).ready(function() {
  function init() {
    var gameRows = $("<table></table>");
    var cellCount = 0;
    for (i = 0; i < 10; i++) {
      var row = $('<tr></tr>').addClass('row');
      for (j = 0; j < 10; j++) {
        cellCount++;
        var cell = $('<td></td>')
          .addClass('cell')
          .attr('id', 'cell_' + cellCount)
          .text(cellCount);
        row.append(cell);
      }
      gameRows.append(row);
    }
    $("#gameBoard").html(gameRows);
  } init();

  //Gen randInt from range
  function randomInt(min, max) {
    return Math.floor(Math.random() * (max - min + 1) + min);
  }

  //define playerBets[]
  var playerBets = [];
  var blockSelect = 0;
  // CLICKED CELL
  $(".cell").click(function() {
    if (blockSelect >= 9) {
      return;
    }
    blockSelect++;
    $(this)
      .removeClass("killPoint")
      .removeClass("firstKillPoint")
      .removeClass("playerBet")
      .removeClass("lostOn");
    $(this).addClass("playerBet");
    playerBets.push($(this).attr("id").replace("cell_", ""));
  });

  //CLICKED CLEAR-BETS
  $("#clearBets").click(function() {
    $(".cell")
      .removeClass("killPoint")
      .removeClass("playerBet")
      .removeClass("lostOn")
      .removeClass("firstKillPoint");
    playerBets = [];
    blockSelect = 0;
  });

  //Loop round (every 10secs)
  //window.setInterval(function(){
  // CLICKED CONFIRM-BETS
  $("#confirmBets").click(function() {
    $(".cell").removeClass("killPoint")
              .removeClass("lostOn")
              .removeClass("firstKillPoint");
    //blockSelect = 0;
    //Gen random number 1/100
    var killPoint = randomInt(1, 100);
    var killPointStr = String(killPoint);
    $("#cell_" + killPoint).addClass("firstKillPoint");
    //Gen 50/50 for direction
    var killDirect = randomInt(0, 1);
    //console.log("Direction:"+killDirect)
    //define/plot killLine[] based on direct/point
    if (killDirect == 0) {
      var killLine = [];
      if (killPointStr.slice(1) == "00") {
        startPoint = 100;
      } else if(killPointStr.slice(1) == "0") {
        var startPoint = killPoint;
      } else {
        var startPoint = Math.ceil((killPoint + 1) / 10) * 10;
      }
      for (i = startPoint; i > startPoint-10; i--) {
        //console.log(i);
        killLine.push(i);
      }
    } else {
      var killLine = [];
      var startPoint = null;
      var endPoint = null;
      if (killPointStr.length == 2) {
        startPointStr = killPointStr.slice(1);
      } else {
        startPointStr = String(killPoint);
      }
      if (killPointStr.slice(1) == "0" || killPointStr.slice(1) == "00") {
        startPoint = 10;
        endPoint = 100;
      } else {
        startPoint = parseInt(startPointStr);
        endPoint = parseInt("9" + startPointStr);
      }
      for (i = startPoint; i <= endPoint; i += 10) {
        //log killLine creation
        //console.log(i);
        killLine.push(i);
      }
    }
    // Add classes for killPoints
    killLine.forEach(function(killPoint) {
      $("#cell_" + killPoint).addClass("killPoint");
    });
    var playerLost = false;
    //check if playerBets[] intersects killLine[]
    // Loop through EACH player bet
    playerBets.forEach(function(playerBet) {
      // Loop through EACH player bet
      killLine.forEach(function(killPoint) {
        // Compare the curent bet to the current killPoint
        if (playerBet == killPoint) {
          playerLost = true;
          $("#cell_" + killPoint).addClass("lostOn");
        }
      });
    });
    if (playerLost == true) {
      //player lost
      //alert("player lost!");
      //else player won
    } else {
      //calculate PROFITZZ
      //alert("player won!");
    }
  });
});
              
            
!
999px

Console