rbdwllr / automata
An Elementary Cellular Automata library for PHP.
0.0.2-beta.2
2022-01-23 13:44 UTC
Requires (Dev)
- phpstan/phpstan: ^0.12.94
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.6
This package is auto-updated.
Last update: 2024-11-23 20:26:28 UTC
README
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