minesweeper some progress
This commit is contained in:
parent
5f623b19cb
commit
e30ed748ad
3 changed files with 175 additions and 1 deletions
|
@ -111,7 +111,21 @@
|
|||
}
|
||||
|
||||
function calculateNearByBombs() {
|
||||
|
||||
for (var rowCounter = 0; rowCounter < matrixModel.rows.length; rowCounter++) {
|
||||
var modelRow = matrixModel.rows[rowCounter];
|
||||
for (var cellCounter = 0; cellCounter < modelRow.cells.length; cellCounter++) {
|
||||
var modelCell = modelRow.cells[cellCounter];
|
||||
modelCell.bombsNearBy =
|
||||
countBomb(rowCounter - 1, cellCounter - 1)
|
||||
+ countBomb(rowCounter - 1, cellCounter)
|
||||
+ countBomb(rowCounter - 1, cellCounter + 1)
|
||||
+ countBomb(rowCounter, cellCounter - 1)
|
||||
+ countBomb(rowCounter, cellCounter + 1)
|
||||
+ countBomb(rowCounter + 1, cellCounter - 1)
|
||||
+ countBomb(rowCounter + 1, cellCounter)
|
||||
+ countBomb(rowCounter + 1, cellCounter + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
function handleClick(aMouseEvent) {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue