Skip to content

Commit

Permalink
winGame verification updated
Browse files Browse the repository at this point in the history
  • Loading branch information
reed-jones committed Apr 1, 2017
1 parent 063e5f9 commit b896ad5
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 111 deletions.
24 changes: 12 additions & 12 deletions getHighScores_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<h4>Easy</h4>
<hr>
<div class="row">
<div class="col-xs-6">
<div class="col-xs-6 col-md-6">
<h4>Name</h4>
</div>
<div class="col-xs-6">
<div class="col-xs-6 col-md-6">
<h4>Time</h4>
</div>

Expand All @@ -25,10 +25,10 @@

while ($row = pg_fetch_array($result)) { ?>
<div class="row">
<div class="col-xs-6">
<div class="col-xs-6 col-md-6">
<?php echo $row['name']; ?>
</div>
<div class="col-xs-6">
<div class="col-xs-6 col-md-6">
<?php echo $row['time']; ?>
</div>
</div>
Expand All @@ -40,10 +40,10 @@
<h4>Medium</h4>
<hr>
<div class="row">
<div class="col-xs-6">
<div class="col-xs-6 col-md-6">
<h4>Name</h4>
</div>
<div class="col-xs-6">
<div class="col-xs-6 col-md-6">
<h4>Time</h4>
</div>

Expand All @@ -52,10 +52,10 @@
while ($row = pg_fetch_array($result)) { ?>

<div class="row">
<div class="col-xs-6">
<div class="col-xs-6 col-md-6">
<?php echo $row['name']; ?>
</div>
<div class="col-xs-6">
<div class="col-xs-6 col-md-6">
<?php echo $row['time']; ?>
</div>
</div>
Expand All @@ -66,21 +66,21 @@
<h4>Hard</h4>
<hr>
<div class="row">
<div class="col-xs-6">
<div class="col-xs-6 col-md-6">
<h4>Name</h4>
</div>
<div class="col-xs-6">
<div class="col-xs-6 col-md-6">
<h4>Time</h4>
</div>

<!--Recieved top 10 ranked Difficult players-->
<?php $result = pg_query($con, "SELECT name, time FROM _Table_ WHERE difficulty = 2 ORDER BY time, id LIMIT 10");
while ($row = pg_fetch_array($result)) { ?>
<div class="row">
<div class="col-xs-6">
<div class="col-xs-6 col-md-6">
<?php echo $row['name']; ?>
</div>
<div class="col-xs-6">
<div class="col-xs-6 col-md-6">
<?php echo $row['time']; ?>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h3 id="secondsWrapper">888<span id="seconds">000</span></h3><br>
<script src="contextMenu/contextMenu.min.js"></script>

<!-- My JS -->
<!--<script src="main.min.js"></script>-->
<script src="main.js"></script>
<script src="main.min.js"></script>
<!-- <script src="main.js"></script> -->
</body>
</html>
14 changes: 14 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,20 @@ function cleanTiles(x, y){
* Reveal entire board when win condition is met
*/
function winGame(){
var bombsFound = width * height;
for(var y = 0; y < height; ++y) {
for (var x = 0; x < width; ++x) {
if (boardArray[y][x].isRevealed)
bombsFound--;
}
}

if(bombsFound != maxBombs)
{
alert("Quit trying to cheat! ;)");
return;
}

// stop playing. You won!
playing = false;
paused = true;
Expand Down
Loading

0 comments on commit b896ad5

Please sign in to comment.