diff --git a/MVC/minesweeper/altSweeper.html b/MVC/minesweeper/altSweeper.html new file mode 100644 index 0000000..d01f779 --- /dev/null +++ b/MVC/minesweeper/altSweeper.html @@ -0,0 +1,11 @@ + + + + + + Document + + + + + \ No newline at end of file diff --git a/MVC/minesweeper/index.html b/MVC/minesweeper/index.html index 368f86c..9757abe 100644 --- a/MVC/minesweeper/index.html +++ b/MVC/minesweeper/index.html @@ -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) { diff --git a/MVC/minesweeper/minesweeper_copy.html b/MVC/minesweeper/minesweeper_copy.html new file mode 100644 index 0000000..e9eb5b6 --- /dev/null +++ b/MVC/minesweeper/minesweeper_copy.html @@ -0,0 +1,149 @@ + + + + + + + + + + Minesweeper + +
+ + + + \ No newline at end of file