Crates.io | rustmaton |
lib.rs | rustmaton |
version | 0.2.3 |
source | src |
created_at | 2023-02-07 01:47:05.895863 |
updated_at | 2023-02-07 02:17:49.744598 |
description | A text editor for Conway's Game of Life |
homepage | https://github.com/deweyjose/rustling |
repository | https://github.com/deweyjose/rustling |
max_upload_size | |
id | 778426 |
size | 244,073 |
A text editor version of Conways Game of Life implemented in Rust.
It's easy - use the key pad to navigate and add more patterns to the grid.
Mouse clicks can set the cursor point for faster navigation!
You can increase or decrease the speed of the simulation using +
or -
keys.
If the console window is resized the game needs to be reset using the c
key.
The installer will create a directory named rustmaton
with the executable and patterns.json file.
curl --location https://github.com/deweyjose/rustling/releases/download/0.2.3/install.sh | sh
If patterns.json is in the current working directory no arguments need to specified to run rustling.
% rustmaton
Or specify a path to patterns.json.
% rustmaton some/path/patterns.json
If you built your own patterns file simply supply a path to it instead.
% rustmaton path/customize.json
The ga me comes with a predefined set of well known pattern types
: oscillators
, stills
, spaceships
. During the simulation only a single pattern type
is active. The pattern type
can be changed by pressing the p
key.
Each pattern type
has an array of patterns. You place a pattern on the grid by typing the number corresponding to its index in the array (not 0 based!). Use the h
help key to see what number key a specific pattern is.
rustmaton loads a predefined set of patterns at startup. Simply place patterns.json in the same directory as the rustmaton binary and run it. Feel free to customize the list of patterns, or even define you're own patterns.
If no shape file can be found at startup a simple blinker is loaded as the default shape.
Example structure
[
{
"name": "methuselahs",
"patterns": [
{
"name": "r-pentomino",
"matrix": [
[0,1,1],
[1,1,0],
[0,1,0]
]
}
]
}
]
Individual cells can be manually set to Alive
or Dead
using the a
or d
key.
Press the h
key to display or hide help. The simulation is paused while help is displayed.
Below is an example of the help screen. If you've made any customizations to patterns.json they will be reflected in the help screen.
# command keys:
a - toggle cursor point alive
b - move cursor to the beginning of the current line
c - clear the screen
d - toggle cursor point dead
e - move cursor to the end of the current line
h - display help, or exit help if currently rendered
l - print the previous pattern again
p - cycle through the pattern classes defined in patterns.json
q - quit
r - rotate the current shape 90 degrees
s - toggle the simulation run loop
' ' - step the simulation forward
+ - speed up the simulation
- - slow down the simulation
[esc] - exit help
ctrl+c - quit
# pattern classes
Select a different pattern class using the p key
Print a shape using the number in () to the left of the name
oscillators
(1) beacon, (2) blinker, (3) koks galaxy, (4) pulsar, (5) toad
spaceships
(1) glider, (2) lwss, (3) hwss
still
(1) beehive, (2) block, (3) boat, (4) loaf, (5) tub