Skip to content

Rust playground project on 1-dimension cellular automata, with command line and gtk GUI and WASM implementation

License

Notifications You must be signed in to change notification settings

BorisBoutillier/rs-cellular-automata

Repository files navigation

Cellular automata

This is playground project to tackle the Rust language. The goal is to play around with 1-dimension cellular automata with different kind of user interaction, CLI, GUI or WEB.

The workspace consist in 4 crates:

  • automata-lib : The main library that contains the automata computation and its rules.
  • automata-cli : a CLI interface to automata-lib with output as text or direct image file.
  • automata-gtk : a GUI interface to automata-lib in GTK.
  • automata-wasm : A web page using WASM for interfacing with automata-lib and javascript for gui part

Compiling

Prerequisites

Compiling

The compilation for automata-lib, automata-cli and automata-gtk is simply using cargo build command:

cargo build --release

The compilation for automata-wasm requires using wasm-pack:

cd automata-wasm
wasm-pack build

CLI

Help for all available option

automata-cli --help

text output in the terminal

automata-cli --colors 2 --rule 30 --steps=10 --width=20
|          *         |
|         ***        |
|        **  *       |
|       ** ****      |
|      **  *   *     |
|     ** **** ***    |
|    **  *    *  *   |
|   ** ****  ******  |
|  **  *   ***     * |
| ** **** **  *   ***|

image output

automata-cli --colors 4 --rule 16673 --steps 320  --width 640 --output 4C_16673.320.png

alt text

GUI

GUI with all controls is simply launched with :

automata-gtk

alt text

WASM

To start the web-page using npm , after building with wasm-pack :

cd automata-wasm/www
npm install
npm run star

You can then open your browser on localhost:8080/ and play with cellular automata !

alt text

About

Rust playground project on 1-dimension cellular automata, with command line and gtk GUI and WASM implementation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published