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
5bfd661664b0866b3938e2c6d9e21ce31957f993
parent
f902fa4868b17a3f2ff2b682951fdda45e2235a3
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2019-10-20 08:49
typo

Diffstat

M src/logic.js 8 ++++----

1 files changed, 4 insertions, 4 deletions


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

@@ -22,11 +22,11 @@ const calculateNextGen = function(state) {
   22    22             calcBoard[p][y] = [];
   23    23             for (let x = 0; x < constants.width; x++) {
   24    24                 if(board[y][x] === -1) continue;
   25    -1                 const friendlyNeighboars = getFriendlyNeighboars(board, x, y, p);
   -1    25                 const friendlyNeighbors = getFriendlyNeighbors(board, x, y, p);
   26    26                 // Rules are here!
   27    27                 if (
   28    -1                     (board[y][x] === p && constants.alive.includes(friendlyNeighboars)) ||
   29    -1                     (board[y][x] !== p && constants.born.includes(friendlyNeighboars))
   -1    28                     (board[y][x] === p && constants.alive.includes(friendlyNeighbors)) ||
   -1    29                     (board[y][x] !== p && constants.born.includes(friendlyNeighbors))
   30    30                 ) {
   31    31                     calcBoard[p][y][x] = p;
   32    32                 } else {
@@ -56,7 +56,7 @@ const calculateNextGen = function(state) {
   56    56     }
   57    57 };
   58    58 
   59    -1 const getFriendlyNeighboars = function(board, x, y, p){
   -1    59 const getFriendlyNeighbors = function(board, x, y, p){
   60    60     let count = 0;
   61    61     for (let deltaX = -1; deltaX <= 1; deltaX++) {
   62    62         for (let deltaY = -1; deltaY <= 1; deltaY++) {