Browse Source

added simple documentation

Thomas Johnson 6 months ago
  1. 32


@ -60,6 +60,38 @@ enum Op {
const USAGE_STRING: &str =
This tool has three subcommands, which can be passed in as arguments.
The first is the `file` subcommand, which reads a pattern from a file and steps the automaton for a number of steps:
file <filename> <x size> <y size> <max steps> <ruleset> <frame delay>
`filename` indicates the file to load the initial pattern from. The file is parsed as if it were ASCII art.
The second is the `random` subcommand, which creates a random initial configuration and steps the automaton for a number of steps:
random <probability> <x size> <y size> <max steps> <ruleset> <frame delay>
The `probability` argument specifies the probability of a cell being alive in the initial state.
The third command in the `randhist` subcommand, which runs many simulations starting in a random state and outputs statistics about them:
randhist <number of samples> <number of threads> <x size> <y size> <max steps> <ruleset>
Some subcommands have have the following arguments:
`x size` and `y size` specify the size of the world, after which it wraps around. (BUG: this cannot be 1.) If it is zero, then the world will be unbounded, although this is disallowed in random trials.
`max steps` is the largest number of steps allowed for cycle detection or simulation.
`ruleset` describes the rules of the ceullular automaton, given in conditions required for birth or survival. For example, Conway's gave of life is specified as B3/S23 -- a cell becomes alive with 3 living neighbors, and stays alive with 2 or 3 living neighbors.
`frame delay` is the number of milliseconds between the printing of frames. If this is zero, then no display will happen at all.
fn main()