MCPcopy Create free account
hub / github.com/MultithreadedJSBook/code-samples / getCell

Method getCell

ch5-game-of-life/gol.js:11–17  ·  view source on GitHub ↗
(x, y)

Source from the content-addressed store, hash-verified

9 }
10
11 getCell(x, y) {
12 const size = this.size;
13 const sizeM1 = size - 1;
14 x = x < 0 ? sizeM1 : x > sizeM1 ? 0 : x;
15 y = y < 0 ? sizeM1 : y > sizeM1 ? 0 : y;
16 return this.cells[size * x + y];
17 }
18
19 static NEIGHBORS = [ // <1>
20 [-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]

Callers 1

iterateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected