hardReact Native#132

Minesweeper Grid (Booscaminas)

Prompt

Implement the core logic functions for Minesweeper.

Write three pure functions:

  1. createBoard() — returns an 8x8 board with 10 bombs placed randomly. Each cell: { bomb: boolean, adjacent: number, revealed: boolean }
  2. revealCell(board, r, c) — returns a NEW board with cell (r,c) revealed. If adjacent=0, auto-reveal neighbors (flood fill). Bomb cells are never revealed by this function — the UI detects the bomb tap and handles game over.
  3. checkWin(board) — returns true if all non-bomb cells are revealed.

Live Preview

Mines: 10

Hints

Solution

Your Code

20 min

Tests

Click Run to test your code