Created
May 4, 2015 14:16
-
-
Save lengarvey/d62bf2df95dc81b8a8fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// init process | |
Minesweeper.initEvents(); // initialize events. Remember to listen on $(document).on('click', '.cell') | |
// etc... | |
Minesweeper.initializeBoard('M'); // create the board of the right size. | |
Minesweeper.placeMines(); // update Minesweeper.world to update the random cells with mine = true; | |
Minesweeper.calculateSurroundingMines(); // updates each cell to figure out the number of mines surrounding it. | |
Minesweeper.render(); // renders the game board. | |
// the structure of the board in the dom should allow you to figure out which cell is clicked on. | |
// something like: | |
// <div class="cell" data-id="1"></div> | |
// | |
// every time someone clicks on a cell it updates the cell in MS.world and calls Minesweeper.render(); | |
// which would replace the entire board with new divs for every cell. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment