Crates.io | cell_sim |
lib.rs | cell_sim |
version | 0.2.1 |
source | src |
created_at | 2022-01-21 04:57:28.099625 |
updated_at | 2022-01-25 06:24:09.530208 |
description | A 1d cell automata simulator for the command line |
homepage | https://github.com/mcclementines/cellsim |
repository | https://github.com/mcclementines/cellsim |
max_upload_size | |
id | 518328 |
size | 16,866 |
cellsim is a 1d cell automata simulator for the command line, inspired by Stephen Wolfram's elementary celluar automata. Most interesting elementary rules are added with the tool, however new rules can be easily specified using a simple encoding.
Licensed under MIT
The binary name for cellsim is in fact cellsim.
The binary for cellsim is currently only available on crates.io, and can be installed via Rust's cargo package manager:
$ cargo install cell_sim
You can also build from source by cloning this repository and building with cargo build
.
By default, cellsim will calculate the automata using Rule 30. To run the default, the following command can be used:
$ cellsim <iterations> <initial state>
For example, to produce the results from the screenshot above, you'd run:
$ cellsim 10 " * "
where in between the quotes spaces represents "dead" cells and asterisks represent "alive" cells.
Further, rules 90, 110, and 184 are also build in. To access these, add the option -r
followed by the rule, like so:
cellsim -r rule90 100 "** * ****** *"
To specify your own rule, you can use the option -c
, followed by an encoded version of your rule. The standard format is as follows:
[size of patterns][pattern 1][result][pattern2][result]...
size of patterns is a 4 bit unsigned binary number, which must be odd. A pattern is of the size specified in size of patterns, and consists of 0s and 1s where a 0 represents a dead cell in a pattern and a 1 represents an alive cell. A result is the state of the next cell if the pattern is found, thus uses 0s and 1s as defined above. For example, Rule 30 is defined this way:
# Rule 30 in the standard format
001111101100101010010111010100110000
# annotated
# [0011][111][0][110][0]... and so on
That covers the basics on the program. Be on the lookout for new functionality to be added.