Build a deterministic 9×9 Minesweeper board in React. Ten mines are fixed so every run is reproducible. The starter supplies the board builder and finished presentation; add immutable state updates, flood-fill reveal, flagging, outcome detection, and keyboard navigation.
10 - flagged cells and may be negative.10, status Game ready, and focus index 0.role="grid" and the 9×9 label on the board, role="gridcell" on each native button, and exactly one cell at tabIndex={0}.hidden, flagged, clear, N adjacent mines, or mine.Keep board, status, and focusIndex in state. Never mutate the current board then pass the same array back to setBoard; clone the cells, run the breadth-first fill on that draft, and commit one new array. Use button refs to move DOM focus after an arrow-key state update.
Do not edit styles.css: it is the persistent visual contract used when the solution is loaded.
The full solution is part of Premium
Walkthrough, edge cases, complexity notes, and the runnable editor unlock with a Premium subscription.
Submissions are part of Premium
Unlock community code, comments, reactions, and framework-specific approaches.
Build a deterministic 9×9 Minesweeper board in React. Ten mines are fixed so every run is reproducible. The starter supplies the board builder and finished presentation; add immutable state updates, flood-fill reveal, flagging, outcome detection, and keyboard navigation.
10 - flagged cells and may be negative.10, status Game ready, and focus index 0.role="grid" and the 9×9 label on the board, role="gridcell" on each native button, and exactly one cell at tabIndex={0}.hidden, flagged, clear, N adjacent mines, or mine.Keep board, status, and focusIndex in state. Never mutate the current board then pass the same array back to setBoard; clone the cells, run the breadth-first fill on that draft, and commit one new array. Use button refs to move DOM focus after an arrow-key state update.
Do not edit styles.css: it is the persistent visual contract used when the solution is loaded.
The full solution is part of Premium
Walkthrough, edge cases, complexity notes, and the runnable editor unlock with a Premium subscription.
Submissions are part of Premium
Unlock community code, comments, reactions, and framework-specific approaches.
Unlock the solution & editor
Runnable editor + tests
Solve in the browser with instant Jest feedback.
Detailed solutions
Walkthroughs, edge cases, and complexity notes.
Multi-framework variants
React, Vue, Vanilla, Angular — same question, different stacks.