cell_sim

Crates.iocell_sim
lib.rscell_sim
version0.2.1
sourcesrc
created_at2022-01-21 04:57:28.099625
updated_at2022-01-25 06:24:09.530208
descriptionA 1d cell automata simulator for the command line
homepagehttps://github.com/mcclementines/cellsim
repositoryhttps://github.com/mcclementines/cellsim
max_upload_size
id518328
size16,866
Jonathan McClement (mcclementines)

documentation

README

cellsim

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

Documentation

Screenshot of some results

A screenshot of results from running cellsim

Installation

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.

User Guide

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.

Commit count: 15

cargo fmt