
I don't think a recursive method is suitable for this kind of problem. THis is my code: const gridSize = 10Ĭonst board = document.querySelector("#minesweeper") It should actually open a much larger area: It starts checking the neighbouring tiles, but stops when the first neighbouring tile has a mine.Īs you can see on the screenshot below (after clicking on tile 1/5) only the tiles until the first "1" are opened. It works propererly apart from the function to open the entire mine-free area when clicking on a mine-free tile. I am trying to build a simple minesweeper game in Javascript.
