RobDWaller / automata

An Elementary Cellular Automata library for PHP.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CircleCI SonarCloud SonarCloud

Automata

An Elementary Cellular Automata library for PHP. All credit goes to Stephen Wolfram and Melanie Mitchell.

Basic Usage

use Automata\Automata;

$automata = new Automata();

$result = $automata->generate(110, 4, '01010');

$result->toArray();

Advanced Usage

use Automata\CellsFactory;
use Automata\RulesFactory;
use Automata\Iterator;

$cellsFactory = new CellsFactory();
$cells = $cellsFactory->create("01010");

$rulesFactory = new RulesFactory();
$rules = $rulesFactory->create(110);

$iterator = new Iterator(new Iterate(), $cells, $rules);

$iterations = $iterator->iterate(4);

$iterations->toArray();

Rules

000 = 0
001 = 1
010 = 1
011 = 1
100 = 0
101 = 1
110 = 1
111 = 0

About

An Elementary Cellular Automata library for PHP.

License:MIT License


Languages

Language:PHP 100.0%