PHP code example of rbdwllr / automata

1. Go to this page and download the library: Download rbdwllr/automata library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rbdwllr / automata example snippets


use Automata\Automata;

$automata = new Automata();

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

$result->toArray();

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