game-of-life-logic

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i game-of-life-logic

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • dasilvacontin