node package manager

game-of-life-logic

game-of-life-logic

Build Status npm npm Downloads Coverage Status

Logic for Conway's Game of Life. It uses a looping-matrix so that entities loop from edge to edge.

Install

$ npm install --save game-of-life-logic

Usage

var GameOfLife = require('game-of-life-logic');
var gameOfLife = new GameOfLife(5, 5)
gameOfLife.copyMatrixAt(1, 1, [
[0, 0, 0],
[1, 1, 1],
[0, 0, 0]
])
gameOfLife.matrix
/* => [
        [0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0],
        [0, 1, 1, 1, 0],
        [0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0]
      ]
*/
gameOfLife.tick()
gameOfLife.matrix
/* => [
        [0, 0, 0, 0, 0],
        [0, 0, 1, 0, 0],
        [0, 0, 1, 0, 0],
        [0, 0, 1, 0, 0],
        [0, 0, 0, 0, 0]
      ]
*/

API

Coming soon...

License

MIT © David da Silva