Skip to content

monarchwadia/conways-game-engine

Repository files navigation

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);

About

Conway's Game of Life engine with fully customizable cellular automaton rules.

Resources

License

Stars

Watchers

Forks

Packages

No packages published