forked from tony-luisi/minesweeper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
minesweeper.js
32 lines (26 loc) · 986 Bytes
/
minesweeper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
document.addEventListener('DOMContentLoaded', startGame)
// Define your `board` object here!
// var board =
function startGame () {
// Don't remove this function call: it makes the game work!
lib.initBoard()
}
// Define this function to look for a win condition:
//
// 1. Are all of the cells that are NOT mines visible?
// 2. Are all of the mines marked?
function checkForWin () {
// You can use this function call to declare a winner (once you've
// detected that they've won, that is!)
// lib.displayMessage('You win!')
}
// Define this function to count the number of mines around the cell
// (there could be as many as 8). You don't have to get the surrounding
// cells yourself! Just use `lib.getSurroundingCells`:
//
// var surrounding = lib.getSurroundingCells(cell.row, cell.col)
//
// It will return cell objects in an array. You should loop through
// them, counting the number of times `cell.isMine` is true.
function countSurroundingMines (cell) {
}