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
1bbf5ed232df1d4478af78d5bc7cd174fbb3984b
parent
ae0bea068555955f5f1b28b379c7b3cf4dea5bc2
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2019-10-26 18:45
improve renderWinState

Diffstat

M TODO.md 1 -
M src/template.js 10 +++++++++-

2 files changed, 9 insertions, 2 deletions


diff --git a/TODO.md b/TODO.md

@@ -6,7 +6,6 @@
    6     6 + reset board after play
    7     7 + better win/loose indication
    8     8 + pause on win/loose
    9    -1 + refactor steps
   10     9 + structure board controls
   11    10 
   12    11 ## II. Logic

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

@@ -63,13 +63,21 @@ const renderMenu = function(state) {
   63    63     ))));
   64    64 };
   65    65 
   -1    66 const renderWinState = function(state) {
   -1    67     if (state.winState) {
   -1    68         return h('p', {}, 'You have won');
   -1    69     } else if (state.winState === false) {
   -1    70         return h('p', {}, 'You have lost');
   -1    71     }
   -1    72 };
   -1    73 
   66    74 export default function(state) {
   67    75     if (state.game) {
   68    76         return h('div', {}, [
   69    77             renderControls(state),
   70    78             h('p', {}, state.game.description),
   71    79             renderBoard(state),
   72    -1             state.winState ? h('p', {}, 'You have won') : null,
   -1    80             renderWinState(state),
   73    81         ]);
   74    82     } else {
   75    83         return renderMenu(state);