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
58ed4737a2a6836b80666a2a13b1f4b5a27bfdd6
parent
18d79f54ece184f01e0f7555da32bbeb944764f4
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2025-01-16 06:03
lint

Diffstat

M src/index.js 4 ++--
M src/template.js 18 +++++++++++-------

2 files changed, 13 insertions, 9 deletions


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

@@ -76,7 +76,7 @@ on('mousedown', '.board-cell', function(state, event) {
   76    76     if (state.game.playing) {
   77    77         return;
   78    78     }
   79    -1     if (event.buttons != 1) {
   -1    79     if (event.buttons !== 1) {
   80    80         return;
   81    81     }
   82    82     const row = this.parentElement;
@@ -144,7 +144,7 @@ on('click', '.js-export', function(state) {
  144   144     download.remove();
  145   145 });
  146   146 
  147    -1 on('click', '.js-quit', function(state) {
   -1   147 on('click', '.js-quit', function() {
  148   148     history.back();
  149   149 });
  150   150 

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

@@ -3,10 +3,14 @@ import scenarios from './scenarios.js';
    3     3 const h = petitDom.h;
    4     4 
    5     5 const getSpaceClass = function(state, y, x) {
    6    -1     if (
    7    -1         (state.game.limitBuildSpace) &&
    8    -1         (x < state.game.limitBuildSpace.x1 || x > state.game.limitBuildSpace.x2 || y < state.game.limitBuildSpace.y1 || y > state.game.limitBuildSpace.y2)
    9    -1     ) return 'limit-outside';
   -1     6     if ((state.game.limitBuildSpace) && (
   -1     7         x < state.game.limitBuildSpace.x1
   -1     8         || x > state.game.limitBuildSpace.x2
   -1     9         || y < state.game.limitBuildSpace.y1
   -1    10         || y > state.game.limitBuildSpace.y2
   -1    11     )) {
   -1    12         return 'limit-outside';
   -1    13     }
   10    14 };
   11    15 
   12    16 const renderBoard = function(state) {
@@ -70,10 +74,10 @@ const renderControls = function(state) {
   70    74     }
   71    75 };
   72    76 
   73    -1 const renderMenu = function(state) {
   -1    77 const renderMenu = function() {
   74    78     return h('div', {'class': 'menu'}, [
   75    79         h('img', {'class': 'logo', 'src': 'logo.jpg', 'alt': 'Game of Death'}),
   76    -1         h('a', {'class': 'btn', 'href': '#!sandbox'}, 'Start sandbox game')
   -1    80         h('a', {'class': 'btn', 'href': '#!sandbox'}, 'Start sandbox game'),
   77    81     ].concat(scenarios.map((scenario, i) => h(
   78    82         'a',
   79    83         {'class': 'btn', 'href': `#!scenario/${i}`},
@@ -100,4 +104,4 @@ export default function(state) {
  100   104     } else {
  101   105         return renderMenu(state);
  102   106     }
  103    -1 };
   -1   107 }