Skip to content

Commit

Permalink
fix viewState neighbors
Browse files Browse the repository at this point in the history
  • Loading branch information
wighawag committed Apr 30, 2024
1 parent 7ece584 commit 7443085
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions web/src/lib/state/ViewState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,14 @@ function merge(
const {x, y} = bigIntIDToXY(BigInt(cellID));

const neighbors = {
N: !!state.cells[xyToBigIntID(x, y - 1).toString()],
NE: !!state.cells[xyToBigIntID(x + 1, y - 1).toString()],
E: !!state.cells[xyToBigIntID(x + 1, y).toString()],
SE: !!state.cells[xyToBigIntID(x + 1, y + 1).toString()],
S: !!state.cells[xyToBigIntID(x, y + 1).toString()],
SW: !!state.cells[xyToBigIntID(x - 1, y + 1).toString()],
W: !!state.cells[xyToBigIntID(x - 1, y).toString()],
NW: !!state.cells[xyToBigIntID(x - 1, y - 1).toString()],
N: !!copyState.cells[xyToBigIntID(x, y - 1).toString()],
NE: !!copyState.cells[xyToBigIntID(x + 1, y - 1).toString()],
E: !!copyState.cells[xyToBigIntID(x + 1, y).toString()],
SE: !!copyState.cells[xyToBigIntID(x + 1, y + 1).toString()],
S: !!copyState.cells[xyToBigIntID(x, y + 1).toString()],
SW: !!copyState.cells[xyToBigIntID(x - 1, y + 1).toString()],
W: !!copyState.cells[xyToBigIntID(x - 1, y).toString()],
NW: !!copyState.cells[xyToBigIntID(x - 1, y - 1).toString()],
};
viewState.neighbors[cellID] = neighbors;
}
Expand Down

0 comments on commit 7443085

Please sign in to comment.