html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!DOCTYPE html>
<html>
<head>
<title>Minesweeper by JtheDroid</title>
</head>
<body oncontextmenu="return false;">
<h1>Minesweeper</h1> <h3>by JtheDroid</h3>
<input type="button" id="settingsButton" value="">
<div id="settings" class="settings round">
Adjust difficulty (0 = No bombs, 100 = Every tile is a bomb)
<br/>
<input type="number" id="inputDifficulty" min="1" max="99" value="">
<input type="button" id="buttonDifficulty" value="Apply">
<br/><br/>
Adjust amount of tiles
<br/>
X:
<input type="number" id="inputXAmount" min="1" max="500" value="">
Y:
<input type="number" id="inputYAmount" min="1" max="500" value="">
<input type="button" id="buttonAmount" value="Apply">
<br/><br/>
</div>
<br/><br/>
<input type="button" id="resetButton" value="Reset">
<br/><br/>
<div id="clickAction" class="veryround">
<input type="button" class="uncover" id="uncoverButton" value="Uncover">
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
body {
background: #505055;
color: #fff;
font-family: sans-serif;
font-size: 1em;
text-align: center;
margin:0;
}
.settings {
background: #404045;
}
.round {
border-radius:30px;
}
.veryround {
border-radius:50px;
}
.uncover{
background-color: green;
color: black;
padding:15 20;
}
.flag{
background-color: orange;
color: black;
padding:15 30;
}
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//Made by JtheDroid
var canvas;
var ctx;
var gridProperties;
var gridSizeX;
var gridSizeY;
var grid;
var mouseOverTile;
var lost;
var won;
var firstClick;
var shareOfBombs;
var clickInverted;
var totalBombs;
var totalBombsDisplay;
var time;
var timeDisplay;
var showSettings;
window.onload = function() {
alert("Minesweeper by JtheDroid\n\nGoal:\nUncover all tiles without finding a bomb\n\n\nClick on tiles to uncover them. If you know where a bomb is, change the mode (orange button) and flag the tile so you don't forget the position\n\n\n When you have flagged all bombs or uncovered all other tiles, you win!\n\nHave fun!");
gridSizeX = gridSizeY = 9;
shareOfBombs = 0.12;
clickInverted = false;
time = 0;
showSettings = true;
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run