1.1.5 • Published 6 years ago

gol-functional v1.1.5

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

Functional Game of Life Engine

This is a functional game of life engine, using ramda

https://en.wikipedia.org/wiki/Conway's_Game_of_Life

Usage

const gol = require('gol-functional')

const sim = gol({
  size: 40,
  speed: 1000,
  generate: true
}, (board) => {
  console.log(board)
})

sim.start()

setTimeout(_ => sim.stop(), 30000)

Parameters

gol(options, onTick)

options

  • size (size of board)
  • speed (speed of game tick)
  • generate ( auto generate board on create)

onTick

  • is a function that is called every game tick to update the ui, the board contains an array of rows, each row contains an array of cell, if the cell contains a zero it is considered dead, if the cell contains a 1 it is alive.

Game Play

When you call gol a object is returned with the following methods:

  • start (starts the simulation)
  • stop (stops the simulation)
  • tick (steps through the simulation once)
  • toggle (allows you to toggle a cell on or off)

Contributions

License

MIT

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago