Minesweeper Game II
OriginalAbout 433 words
Minesweeper is a classic single-player game. Players need to figure out whether a hidden cell is a mine, based on the known information, and mark the position of mines on a grid.
In this game challenge, you need to finish the function expandClick(board, i, j)
. This function should implement the algorithm for revealing the map when a user clicks a cell:
When you click a cell board[i][j]
, this cell will show the number of mines in its 8 neighbors. If the cell itself is a mine, just return. If there are no mines around (the number is 0), the function should automatically reveal its neighboring cells, and continue this process until it reaches cells with numbers.