diff --git a/src/modules/core.js b/src/modules/core.js index e77c072..499c4e2 100644 --- a/src/modules/core.js +++ b/src/modules/core.js @@ -46,7 +46,8 @@ function createBoard(state, rules, max) { } else { nextState = evolve1d(prevState, rules); } - board = board.concat([nextState]); + // flat array + board.push(...nextState); prevState = nextState; } return board; diff --git a/src/modules/picture.js b/src/modules/picture.js index 117d358..6edda32 100644 --- a/src/modules/picture.js +++ b/src/modules/picture.js @@ -57,7 +57,7 @@ export function boardToPic(board) { const dead = board.cellProperties.deadColor; const img = new ImageData(board.width, board.height); const colors = [hexToRGB(live), hexToRGB(dead)]; - board.grid.flat().reduce((acc, cell, index) => { + board.grid.reduce((acc, cell, index) => { const color = colors[(cell === 1) & 1]; const i = index * 4; acc[i] = color[0];