Created
July 19, 2012 15:49
-
-
Save thrashr888/3144853 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // codetest.js | |
| // Given initial state of a minesweeper board | |
| var COLS = 8; | |
| var ROWS = 8; | |
| var DIFFICULTY = 0.2; | |
| var mines = []; | |
| for (var i = 0 ; i < COLS ; ++i){ | |
| mines[i] = []; | |
| for(var j = 0 ; j < ROWS ; ++j){ | |
| mines[i][j] = Math.random() > DIFFICULTY; | |
| } | |
| } | |
| console.log(mines.join('<p>')); | |
| // write a function that takes a row and column as parameters and returns the number of adjacent mines. How the value of "the input location is a mine" is handled is left as an exercise to the reader. | |
| // you have 40 minutes to complete the test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment