npm.io
1.0.0 • Published 10 years ago

game-of-life-logic

Licence
MIT
Version
1.0.0
Deps
1
Vulns
0
Weekly
0
Stars
4

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

Keywords