0.2.0 • Published 3 years ago

@mark-halls/game-of-life-data v0.2.0

Weekly downloads
7
License
ISC
Repository
github
Last release
3 years ago

Game of Life Data

A simple library of functions for generating and consuming game of life data.

Getting Started

Generate a random set of game of life xy coordinates.

import { create, next } from "@mark-halls/game-of-life-data";

// specify the dimensions of our starting data and how many points we want
const gameSettings = {
  xMin: 0,
  xMax: 100,
  yMin: 0,
  yMax: 100,
  density: 0.3, //a number between 0 and 1, 0.3 is 30% coverage
};

const coords = create(gameSettings);

Get the next set of cell coordinates using game of life rules

const newCoords = next(coords);

Seeding a game

You can also create a seeded game for reproducible grids

import { createSeeded, next } from "@mark-halls/game-of-life-data";

const gameSettings = { ... };

const seed = "Any String";

const coords = createSeeded(gameSettings, seed);
0.2.0

3 years ago

0.1.0

3 years ago

0.1.1

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago