Skip to content

Commit

Permalink
Fix expand out bug
Browse files Browse the repository at this point in the history
  • Loading branch information
maniator committed Jul 28, 2017
1 parent eb4836d commit 039e95c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/caculateBombsInRows.js
Expand Up @@ -120,7 +120,7 @@ export const calculateBombsInRows = ({ rows, columns, bombs, noBomb = {} }) => {
passThrough: true,
};
});

// fill in missing bombs based on emptyCellMap
if (bombCount !== bombs) {
const emptyCellMap = Object.keys(emptyCells).map((cell) => {
Expand All @@ -132,7 +132,7 @@ export const calculateBombsInRows = ({ rows, columns, bombs, noBomb = {} }) => {
box: board[r][c],
};
});

for (let i = 0; i < emptyCellMap.length && bombCount <= bombs; ++i) {
const { rowIndex, boxIndex, box } = emptyCellMap[i];

Expand Down
2 changes: 1 addition & 1 deletion src/expandOutFromBlock.js
Expand Up @@ -34,7 +34,7 @@ export const expandOutFromBlock = ({ board, row, column, autoClick }, checkedPoi
newBoard = expandOutFromBlock({ board: newBoard, row: row + 1, column: column, autoClick }, checkedPoints, shouldPassThroughCallback);
newBoard = expandOutFromBlock({ board: newBoard, row: row - 1, column: column, autoClick }, checkedPoints, shouldPassThroughCallback);
newBoard = expandOutFromBlock({ board: newBoard, row: row, column: column + 1, autoClick }, checkedPoints, shouldPassThroughCallback);
newBoard = expandOutFromBlock({ board: newBoard, row: row, column: column - 1, autoClick }, checkedPoints);
newBoard = expandOutFromBlock({ board: newBoard, row: row, column: column - 1, autoClick }, checkedPoints, shouldPassThroughCallback);
// diagonals
newBoard = expandOutFromBlock({ board: newBoard, row: row - 1, column: column - 1, autoClick }, checkedPoints, shouldPassThroughCallback);
newBoard = expandOutFromBlock({ board: newBoard, row: row - 1, column: column + 1, autoClick }, checkedPoints, shouldPassThroughCallback);
Expand Down

0 comments on commit 039e95c

Please sign in to comment.