https://github.com/adri326/single-rotation
Specialized Rust implementation of the "Single Rotation" reversible cellular automaton
https://github.com/adri326/single-rotation
simulation singlerot
Last synced: over 1 year ago
JSON representation
Specialized Rust implementation of the "Single Rotation" reversible cellular automaton
- Host: GitHub
- URL: https://github.com/adri326/single-rotation
- Owner: adri326
- Created: 2021-04-17T18:34:54.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-20T20:09:55.000Z (about 5 years ago)
- Last Synced: 2025-01-28T10:51:37.371Z (over 1 year ago)
- Topics: simulation, singlerot
- Language: Rust
- Homepage:
- Size: 47.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Single-rotation cellular automaton
This is a rust implementation of the ["single rotation" cellular automaton](http://dmishin.blogspot.com/2013/11/the-single-rotation-rule-remarkably.html).
## Installation and usage
First, clone and build this repository:
```sh
git clone https://github.com/adri326/single-rotation
cd single-rotation
cargo build --release
```
Then, run it:
```sh
./target/release/single-rotation
```
It will then listen for an [RLE-like](https://conwaylife.com/wiki/Run_Length_Encoded) formatted input string through the standard input (stdin).
You can type such a string yourself:
```
x = 0, y = 0
o$o2$o$o!
```
Then, hit enter and the simulation will begin.
The `x` and `y` parameters are optional and will default to `0`.
These are the parameters that are accepted:
- `x`, sets the `X` coordinate of the top-left corner (unlike classical RLE, where the `x` argument corresponds to the width of the pattern, default `0`)
- `y`, sets the `Y` coordinate of the top-left corner (unlike classical RLE, where the `y` argument corresponds to the height of the pattern, default `0`)
- `s`, which sets the number of simulation step between frames (default `1`)
- `i`, which sets the minimum time interval between frames, in milliseconds (default `100`)
- `u`, the "smoothing" factor for the interpolation in the rendered view; a value of `4` will visually hide the 4-step oscillator nature of isolated cells (default `4`)
Additionally, the `c` tag allows you to change the color of the particle.
When put together, it looks like this:
```
x = 0, y = 0, s = 41, i = 1000
4bobo2$b2ob3o!
```
You can also use shellscript notation to redirect stdin from a file:
```sh
./target/release/single-rotation < examples/lightest-slow.rle
```
By default, a CLI representation of the simulation will be displayed. You can switch to a window version instead by running it with the `-g` option:
```sh
./target/release/single-rotation -g < examples/lightest-slow.rle
```