(x, y)
| 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] |