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
496a0c97dfd8b77fa1a8c712a99b76023068c124
parent
916225c95471ee5268d79a5e55fb4f92fa24be8a
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2019-10-20 10:29
GAIA UI

Diffstat

M src/index.js 8 +++-----
M style.css 1 +

2 files changed, 4 insertions, 5 deletions


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

@@ -59,10 +59,11 @@ on('mousedown', '.board-cell', function(state, event) {
   59    59     const board = row.parentElement;
   60    60     const x = Array.prototype.indexOf.call(row.children, this);
   61    61     const y = Array.prototype.indexOf.call(board.children, row);
   62    -1     if (state.board[y][x] === state.currentPlayer) {
   -1    62     const currentPlayer = state.currentPlayer === constants.EMPTY ? constants.GAIA : state.currentPlayer;
   -1    63     if (state.board[y][x] === currentPlayer) {
   63    64         state.board[y][x] = constants.EMPTY;
   64    65     } else {
   65    -1         state.board[y][x] = state.currentPlayer;
   -1    66         state.board[y][x] = currentPlayer;
   66    67     }
   67    68 });
   68    69 
@@ -81,9 +82,6 @@ on('click', '.js-play', function(state) {
   81    82 
   82    83 on('click', '.js-current-player', function(state) {
   83    84     state.currentPlayer = (state.currentPlayer + 1) % constants.playerCount;
   84    -1     if (state.currentPlayer === 0) {
   85    -1         state.currentPlayer = 1;
   86    -1     }
   87    85 });
   88    86 
   89    87 on('click', '.js-export', function(state) {

diff --git a/style.css b/style.css

@@ -33,6 +33,7 @@ body {
   33    33 .fg-3 {color: #4daf4a}
   34    34 .fg-4 {color: #984ea3}
   35    35 
   -1    36 .bg--1 {background-color: black}
   36    37 .bg-1 {background-color: #e41a1c}
   37    38 .bg-2 {background-color: #377eb8}
   38    39 .bg-3 {background-color: #4daf4a}