game-of-death

antagonistic game of life  https://xi.github.io/game-of-death/
git clone https://git.ce9e.org/game-of-death.git

commit
916225c95471ee5268d79a5e55fb4f92fa24be8a
parent
d85e89cca20e4e868cbfe756f97efc5da78c10e6
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2019-10-20 10:24
add constant for GAIA

Diffstat

M src/constants.js 1 +
M src/logic.js 2 +-

2 files changed, 2 insertions, 1 deletions


diff --git a/src/constants.js b/src/constants.js

@@ -1,5 +1,6 @@
    1     1 module.exports = {
    2     2     EMPTY: 0,
   -1     3     GAIA: -1,
    3     4 
    4     5     alive: [2,3],
    5     6     born: [3],

diff --git a/src/logic.js b/src/logic.js

@@ -21,7 +21,7 @@ const calculateNextGen = function(state) {
   21    21         for (let y = 0; y < constants.height; y++) {
   22    22             calcBoard[p][y] = [];
   23    23             for (let x = 0; x < constants.width; x++) {
   24    -1                 if(board[y][x] === -1) continue;
   -1    24                 if (board[y][x] === constants.GAIA) continue;
   25    25                 const friendlyNeighbors = getFriendlyNeighbors(board, x, y, p);
   26    26                 // Rules are here!
   27    27                 if (