game-of-life-logic
v1.0.0
Published
Logic for Conway's Game of Life. It uses a looping-matrix so that entities loop from edge to edge.
Downloads
6
Maintainers
Readme
game-of-life-logic
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