@monarchwadia/conways-game-engine
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Conway's Game of Life

Author: Monarch Wadia

Introduction

This is a very simple implementation of Conway's Game of Life, whipped up in about ~5 hours. It features a node-compatible engine, configurable board height and width, and configurable rules.

The configurable rules are pretty interesting and are worth playing around with.

Read the changeblog!

Starting with v1.1.0 (which adds Typescript support), I'm documenting all changes to this project. You can read the changeblog here. I hope you enjoy it!

Usage

See examples/simple-node

Configuring cellular automaton rules

See examples/custom-rules

Configuration Options

Below are configuration options with their default values.

const { ConwaysGameEngine, defaultRules } = require('@monarchwadia/conways-game-engine');

const config = {
  // Width of the board. 
  // Defaults to 10.
  rowSize: 10

  // Height of the board. 
  // Defaults to 10.
  colSize: 10,

  // The cellular automata rules. The default is Conway's Game of Life. 
  // You can modify these. See "Configuring Rules" section.
  // Defaults to the result of `defaultRules()`, which is called internally.
  rules: defaultRules(), 

  // Usually, each cell can only match a single rule, otherwise it throws an error. Set to 'true' to allow multiple rules.
  // Defaults to false.
  allowMultipleRuleMatches: false 
}

const engine = ConwaysGameEngine(config);

Package Sidebar

Install

npm i @monarchwadia/conways-game-engine

Weekly Downloads

2

Version

1.1.0

License

MIT

Unpacked Size

344 kB

Total Files

36

Last publish

Collaborators

  • monarchwadia