From 8b6e1000bc888843ebda25c07e4c7129e901e243 Mon Sep 17 00:00:00 2001 From: Adrien Jaguenet Date: Tue, 20 Aug 2024 13:57:09 +0200 Subject: [PATCH] Fixed improper rendering of exploded mines and their neighbours --- main.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index f56674e..0c66e8c 100644 --- a/main.js +++ b/main.js @@ -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"; }