Skip to content

Commit

Permalink
Fix shrink method: Update position first so getIndicesInDirection works
Browse files Browse the repository at this point in the history
  • Loading branch information
MaPePeR committed Jan 2, 2024
1 parent 94190d5 commit 56e9c7f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion game.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ class GameState {
}

const shrinkFromDirection = (box) => {
updateShrink(box)
for (const i of getIndicesInDirection(box)) {
if (VALIDATION) {
const cell = this.board[i]
Expand All @@ -306,7 +307,6 @@ class GameState {
}
this.board[i] = null;
}
updateShrink(box)
for (const other of box[neighbor_param]) {
swapOutEl(other[reverse_neighbor_param], box)
}
Expand Down

0 comments on commit 56e9c7f

Please sign in to comment.