could you please help this program how An appealing user interface with an interactive CSS design, where squares are unveiled by mouse clicks? example code: Mines
(minesweeper)
could you please help this
unveiled by mouse clicks?
example code:
<!DOCTYPE html>
<html>
<title>Mines</title>
<head>
<script src="minefield.js"></script>
<script>
var minefield = null;
function newGame() {
minefield = new Minefield(10, 10, 10);
print();
}
function check() {
var x = document.getElementById("x").value;
var y = document.getElementById("y").value;
window.alert(minefield.symbol(x, y));
}
function hit() {
var x = document.getElementById("x").value;
var y = document.getElementById("y").value;
minefield.unveil(x, y);
print();
}
function print() {
var remaining = minefield.veiled + minefield.explosions - 10;
document.getElementById("output").innerHTML =
minefield.toString() + "\n" + remaining + "/" + minefield.explosions;
}
</script>
</head>
<body>
<pre id="output"></pre>
<p>
<input type="number" id="x" value = "0" min="0" max="9">
<input type="number" id="y" value = "0" min="0" max="9">
<input type="button" value="Check" onclick="check()">
<input type="button" value="Hit" onclick="hit()">
<input type="button" value="New" onclick="newGame()">
</p>
<script>
newGame();
</script>
</body>
</html>
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images