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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="rules">
	<p>This is a game where there is a "hashing" limit of 420 blocks or when the Bitcoin Genesis Block boss hashes 1420 times with a two block cool down time(1422x)...<br /> ...get ready and keep your hashing fingers healthy for this...  hash your way to the top of the snapshot leaderboards to win CCGX prizes & have fun!</p>
	<div class="press rulespress">CLOSE RULES</div>
</div>
<div class="leaderBoard">
	<span class="title">BLOCK HASH RACE</span>
	<span class="time">Blocks left to hash: <span id="jsVar">420</span></span>
	<div id="container">
		<div class="playerBox human">
			<span class="playerName">CCG DApp Blazer</span>
			<i class="playerScore" id="score">0</i>
		</div>
		<div class="playerBox">
			<span class="playerName">Bitcoin Genesis Block *Impossible To 51% Attack*</span>
			<i class="playerScore" id="score1">0</i>
		</div>
		<div class="playerBox">
			<span class="playerName">Satoshi Nakamoto *Very Hard To 51% Attack*</span>
			<i class="playerScore" id="score2">0</i>
		</div>
		<div class="playerBox">
			<span class="playerName">Charlie Lee *Moderatly Hard To 51% Attack*</span>
			<i class="playerScore" id="score3">0</i>
		</div>
		<div class="playerBox">
			<span class="playerName">Vitalik Buterin *Moderate/Easy To 51% Attack*</span>
			<i class="playerScore" id="score4">0</i>
		</div>
		<div class="playerBox">
			<span class="playerName">Justin Sun *Moderate/Easy To 51% Attack*</span>
			<i class="playerScore" id="score5">0</i>
		</div>
	</div>
	<div class="playbtns">
		<div class="press start" id="start">RUN NODE</div>
		<div class="press play" id="play">HASHING POWER</div>
		<div class="press playAgain" id="playAgain">HASH AGAIN</div>
	</div>
</div>
            
          
!
            
              body {
	background: #3E5D6B;
	background: linear-gradient(45deg, #CE5C2B, #195D7B);
	height: 100%;
	background-size: cover;
	background-repeat: no-repeat;
	background-attachment: fixed;
	font-family: sans-serif;
	font-weight: 100;
	color: #fff;
}

.leaderBoard {
	position: absolute;
	height: 400px;
	width: 500px;
	top: 50%;
	left: 50%;
	margin: -200px 0 0 -250px;
	background: #333;
	background: RGBa(0, 0, 0, 0.1);
	display: block;
	text-align: center;
	padding: 20px 10px;
	color: #fff;
	z-index: 1;
}

.title {
	font-size: 20px;
	border-bottom: 2px solid #fff;
}

.playerBox {
	text-align: left;
	background: #d9d9d9;
	padding: 10px;
}

.playerName,
.playerScore {
	font-size: 14px;
	color: #333;
}

.playerScore {
	float: right;
}

.playbtns {
	margin-top: 30px;
}

.play {
	display: none;
}

.start {
	display: block;
}

.press {
	border: 1px solid #fff;
	padding: 20px;
	width: 130px;
	height: 70px;
	margin: auto;
	box-sizing: border-box;
	cursor: pointer;
	transition: border-width 0.5s ease, background 1s ease, border-radius 0.5s ease;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
	user-select: none;
}

.press:hover {
	border-width: 5px;
	background: #fff;
	color: #333;
	border-radius: 5px;
}

.press:active {
	margin-top: 3px;
	height: 73px;
}

.time {
	display: block;
	margin: 20px 0;
}

.human {
	background: #5B985B;
}

.human .playerName,
.human .playerScore {
	color: #d9d9d9;
	font-weight: 300;
}
.rules {
	position: fixed;
	top: 0;
	right: 0;
	left: 0;
	bottom: 0;
	background: #333;
	background: RGBa(0,0,0,0.7);
	text-align: center;
	font-size: 20px;
	z-index: 2;
}
.playAgain {
	display: none;
}
            
          
!
            
              	var ai1Score = 0,
		ai2Score = 0,
		ai3Score = 0,
		ai4Score = 0,
		ai5Score = 0,
		humanScore = 0,
		sec = 420,
		over = false;
	var $divs = $(".playerBox");
$(".rulespress").on("click",function() {
		$(".rules").fadeOut(1000);			
});
	$("#start").on("click", function() {

		$("#start").css("display", "none");
		$("#play").css("display", "block");



		setInterval(function() {
			document.getElementById("jsVar").innerHTML = sec;
			sec--;
			if (sec === 0) {
				alert("The Race Has Ended, Bitcoin Still Remains King!");
				over = true;
				$("#play").css("display","none");
				$("#playAgain").css("display","block");
			} else if (sec < 0) {
				sec = 0;
			}
		}, 420);
		setInterval(function() {
			var numericallyOrderedDivs = $divs.sort(function(a, b) {
				return $(b).find("i").text() - $(a).find("i").text();
			});
			$("div#container").html(numericallyOrderedDivs);
			document.getElementById("score1").innerHTML = ai1Score;
			if (!over) {
				ai1Score++;
			} else {
				document.getElementById("score1").innerHTML = ai1Score;
			}
		}, 124);
		setInterval(function() {
			document.getElementById("score2").innerHTML = ai2Score;
			if (!over) {
				ai2Score++;
			} else {
				document.getElementById("score2").innerHTML = ai2Score;
			}
		}, 154);
		setInterval(function() {
			document.getElementById("score3").innerHTML = ai3Score;
			if (!over) {
				ai3Score++;
			} else {
				document.getElementById("score3").innerHTML = ai3Score;
			}
		}, 175);
				setInterval(function() {
			document.getElementById("score4").innerHTML = ai4Score;
			if (!over) {
				ai4Score++;
			} else {
				document.getElementById("score4").innerHTML = ai4Score;
			}
		}, 180);
				setInterval(function() {
			document.getElementById("score5").innerHTML = ai5Score;
			if (!over) {
				ai5Score++;
			} else {
				document.getElementById("score5").innerHTML = ai5Score;
			}
		}, 180);		
		$("#play").on("click", function() {
         if (!over) {
			humanScore += 1;
			}
			else {
				humanScore = humanScore;
			}
			$("#score").html(humanScore);

		});
		$("#playAgain").on("click", function() {
			window.location.reload(true);
		});
	});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console