1 个不稳定版本
0.1.2 | 2021 年 6 月 27 日 |
---|---|
0.1.1 |
|
0.1.0 |
|
#1418 in 数学
330KB
620 代码行
cellular
cellular
是一个命令行工具,允许使用基本的细胞自动机生成 gif 图像。 (在此处了解有关基本细胞自动机的更多信息。) 它支持使用随机种子启动自动机,并通过命令行或文件直接提供初始输入。
安装
通过 cargo
cargo install cellular
从源码
下载最新版本的 tar 包并执行以下操作
tar -xvzf cellular-x.y.z.tar.gz .
cd cellular
cargo install --path .
请注意,x.y.z
是您下载的 tar 包的版本号。
用法
运行以下命令以查看所有可用选项和标志
cellular --help
示例
从随机的初始位图开始
cellular --width 800 --height 600 --frames 100 --density 0.6 --rule 106 --output hello_cellular.gif
或
cellular -w 800 -h 600 -f 100 -d 0.6 -r 106 -o hello_cellular.gif
当传递帮助标志时,将显示所有选项及其快捷语法
→ cellular --help
cellular
A simple command-line based cellular automaton animation creator
USAGE:
cellular [FLAGS] [OPTIONS] --frames <frames> --height <height> --width <width>
FLAGS:
--help Prints help information
-n, --no-prog disable progress bar
-V, --version Prints version information
OPTIONS:
-b, --bitmap <bitmap> Input bitmap as string of 1s and 0s
-d, --density <density> Probability that each cell in initialized bit vector will be occupied. Should be between
0.0 and 1.0 [default: 0.5]
-f, --frames <frames> Number of frames in final animation
-h, --height <height> Specifies height of output image
-i, --infile <infile> path to file containing initial bitmap as string of 1s and 0s
-o, --output <output> Specifies output file. Defaults to output_w<width>_h<height>_f<frames>_r<rule>.gif
-r, --rule <rule> 8 bit unsigned integer which specifies the cellular automaton to simulate [default: 110]
-w, --width <width> Specifies width of output image
从作为命令行参数提供的输入开始
echo "10010111000111" > file
cellular --bitmap 10010111000111 -h 600 -f 100 -d 0.6 -r 106 -o hello_cellular.gif
从文件提供的输入开始
echo "10010111000111" > file
cellular --infile file -h 600 -f 100 -d 0.6 -r 106 -o hello_cellular.gif
示例输出
cellular -b 1100111101110100110100011011111110101111101110111001010110011010010001010011111011101110000011100100 -h 100 -f 200 -r 106
依赖项
~5–14MB
~143K SLoC