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
019970b3cfaa4c3367cec745b6aa3d8b1eee1ed4
parent
b2e31880da3be1ae56ec3962f0d29b0861b9daa6
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2019-10-31 06:27
use Infinity for missing tileLimit

so we can skip the checks

Diffstat

M src/index.js 12 ++++--------

1 files changed, 4 insertions, 8 deletions


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

@@ -67,14 +67,10 @@ on('mousedown', '.board-cell', function(state, event) {
   67    67     ) return;
   68    68     if (state.game.board[y][x] === currentPlayer) {
   69    69         state.game.board[y][x] = constants.EMPTY;
   70    -1         if (state.game.tileLimit !== undefined) {
   71    -1             state.game.tileLimit += 1;
   72    -1         }
   -1    70         state.game.tileLimit += 1;
   73    71     } else if (state.game.board[y][x] === constants.EMPTY) {
   74    -1         if (state.game.tileLimit !== undefined) {
   75    -1             if (state.game.tileLimit < 1) return;
   76    -1             state.game.tileLimit -= 1;
   77    -1         }
   -1    72         if (state.game.tileLimit < 1) return;
   -1    73         state.game.tileLimit -= 1;
   78    74         state.game.board[y][x] = currentPlayer;
   79    75     }
   80    76 });
@@ -145,7 +141,7 @@ on('click', '.js-menu-scenario', function(state) {
  145   141         board: clone(scenarios[i].board),
  146   142         description: scenarios[i].description,
  147   143         winCondition: scenarios[i].winCondition,
  148    -1         tileLimit: scenarios[i].tileLimit,
   -1   144         tileLimit: scenarios[i].tileLimit || Infinity,
  149   145         limitBuildSpaceA: scenarios[i].limitBuildSpaceA,
  150   146         limitBuildSpaceB: scenarios[i].limitBuildSpaceB,
  151   147         currentPlayer: 1,