Minesweeper Game II
OriginalAbout 426 words
Prerequisite Knowledge
Before reading this article, you need to learn:
Minesweeper is a classic single-player game where players need to determine if unknown tiles in a grid are mines based on known information and mark the positions of the mines.
In this game challenge, please complete the function expandClick(board, i, j)
to implement the algorithm for expanding the map when a user clicks a cell:
When a cell board[i][j]
is clicked, it will display the number of mines in the surrounding 8 cells. If the clicked cell is a mine, return immediately. If there are no surrounding mines (the number is 0), continue to automatically expand the surrounding cells until a cell with a number is encountered.