README

CellularAutomata

Raku package for representation and evolution of cellular automata.

Installation

From Zef ecosystem:

zef install CellularAutomata

From GitHub:

zef install https://github.com/antononcube/Raku-CellularAutomata.git

Usage examples

Two steps of Rule 30 over a specified array:

use CellularAutomata;

cellular-automaton(30, [1, 0, 0, 0, 0, 0], 2)
# [[1 0 0 0 0 0] [1 1 0 0 0 1] [0 0 1 0 1 1]]

Four steps of initialization specification:

.say for cellular-automaton(30, [[1,], 0], 4)
# [0 0 0 0 1 0 0 0 0]
# [0 0 0 1 1 1 0 0 0]
# [0 0 1 1 0 0 1 0 0]
# [0 1 1 0 1 1 1 1 0]
# [1 1 0 0 1 0 0 0 1]

Show the table of rule 90;

rule-table(90, method => Whatever); # method takes also 'text' and 'html' 
# ā– ā– ā–   ā– ā– ā–”  ■▔■  ■▔▔  ▔■■  ▔■▔  ▔▔■  ▔▔▔
#  ā–”    ā–     ā–”    ā–     ā–     ā–”    ā–     ā–”

Show rules of rule 90:

use CellularAutomata::Utilities; 
cellular-automaton-from-number(90)
# ((1 1 1) => 0 (1 1 0) => 1 (1 0 1) => 0 (1 0 0) => 1 (0 1 1) => 1 (0 1 0) => 0 (0 0 1) => 1 (0 0 0) => 0)

Plot the array of 20 steps of Rule 30:

use Graphviz::DOT::Chessboard;

my @mat = cellular-automaton(30,[[1,], 0], 20);
dot-matrix-plot(@mat, :9graph-size, :0tick-font-size, :0tick-offset):svg

izef_cellularautomata_dist_docs_30rule_20steps_svg

For more examples see the Jupyter notebook "CellularAutomaton.ipynb".

References

[Wk1] Wikipedia entry, "Cellular automaton".

[WRI1] Wolfram Research, Inc., CellularAutomaton, (2002 introduced, 2017 last update), Wolfram Language & System Documentation Center

CellularAutomata v0.0.1

Raku package for the representation and evolution of cellular automata.

Authors

  • Anton Antonov

License

Artistic-2.0

Dependencies

Data::Transformers:ver<0.0.2+>Math::SparseMatrix

Test Dependencies

Provides

  • CellularAutomata
  • CellularAutomata::Scan
  • CellularAutomata::Sparse
  • CellularAutomata::Utilities

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.