Fixed improper rendering of exploded mines and their neighbours

This commit is contained in:
2024-08-20 13:57:09 +02:00
parent 16568f59dc
commit 8b6e1000bc
+4 -1
View File
@@ -88,7 +88,7 @@ function get_neighbours(cell) {
function count_neighbouring_mines(cell) {
count = 0;
get_neighbours(cell).forEach(function (c) {
if (c.classList.contains("mine")) {
if (c.classList.contains("mine") || c.classList.contains("exploded")) {
count += 1;
}
})
@@ -120,6 +120,9 @@ function lose_game() {
cell.classList.remove("unknown");
cell.classList.add("known");
reveal_mines(cell);
if (cell.classList.contains("exploded")) {
cell.innerText = "";
}
});
$("#newgame").style.display = "block";
}