vue-game-of-life

1.0.15 • Public • Published

A Vue component to render a John Conway's Game of Life

Demo

Game of life

Install

npm install vue-game-of-life --save

How to use

Import and register the plugin as usual

import GameOfLife from 'vue-game-of-life'
 
Vue.use(GameOfLife);

Then use it as you would with any component

<game-of-life></game-of-life>

Configuration

The following props can be sent to the component:

Name Type Default Desctiption
cols Number 100 Number of columns
rows Number 100 Number of rows
cellWidth Number 5 Width of each cell
tickInterval Number 100 Time between each 'tick' in milliseconds
color String #ddd Color to display the alive cells
alivePercent Number 10 Initial percent of alive cells

Getting data out

You can also get some data out of the component, such as number of ticks, cells alive and dead cells.

Do that using a slot scope

example:

<GameOfLife v-slot:default="{ ticks, cellsAlive, cellsDead }">
    Tick: {{ ticks }}, Alive: {{ cellsAlive }}, Dead: {{ cellsDead }}
</GameOfLife>

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.152latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.152
1.0.140
1.0.130
1.0.120
1.0.110
1.0.100
1.0.90
1.0.80
1.0.70
1.0.61
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i vue-game-of-life

Weekly Downloads

3

Version

1.0.15

License

MIT

Unpacked Size

235 kB

Total Files

11

Last publish

Collaborators

  • iak