home *** CD-ROM | disk | FTP | other *** search
- lca: generate linear cellular automata.
- Usage: lca [options]
- This program calculates and displays succeeding generations of linear
- cellular automata. LCA are related to the Game of Life, but are one- rather
- than two-dimensional. Also, while in the Game of Life each cell is in one
- of two states (alive or dead), LCA may have many states, and in this
- implementation the number of states is not fixed.
- The state of each cell is refered to as its value. Each cell has a value
- between zero and one less than the number of possible states. To find the
- value of the cell in the next generation, its current value and the current
- values of the cells on either side are added together. The result is used
- to select a "rule". There is one rule for each possible result. Thus, if
- each cell has four possible values (0-3), the sum of the three cells will be
- between 0 and 9, and there will be ten rules. Each rule is a value which
- will be the new value of the cell. For example, if the values of a cell,
- its left neighbor, and it right neighbor are 2, 0, and 3, and the value of
- rule 5 is 1, then the value of the cell in the next generation will be 1.
- The cells are arranged in a circular configuration; that is, the leftmost
- and rightmost cells are taken to be neighbors.
- To display the cells, a unique character is associated with each value,
- and the character associated with a particular value is what is printed to
- represent a cell of that value. Thus, the cells are displayed in the form
- of a string of characters. The number of cells is typically chosen to be
- one less than the width of the display device that will be used, for
- convenience in display and to avoid problems with line wrap. Succeeding
- generations of cells will be printed on succeeding lines. The two-
- dimentional, ongoing pattern produced by succeeding generations of cells can
- be extremely interesting.
- The following arguments are used to determine the nature of the LCA:
- -a<associated chars> : a is followed by a string of chars. The leftmost
- char should be the character to be associated with value (state) 0; the next
- char should be the character to be associated with value 1, etc. The total
- number of chars will determine the number of possible states. If -a is not
- given, the associated char string defaults to " .+X".
- -r<rules> : r is followed by a series of integers separated by commas.
- The leftmost number should be the value of rule 0; the next, the value of
- rule 1, etc. The number of rules given should be (1 + 3 * [highest possible
- value of a cell, as determined by the -a argument]), since there must be one
- rule for each possible value of the sum of the three cells. For example, if
- four chars are given with the -a argument, then the possible values of a
- cell are 0 - 3, and there should be 10 rules given with the -r argument (one
- for each of the possible sums 0 - 9). If there are not enough rules, the
- highest rules will be set to 0.
- -c<char rules> : The rules may be specified by giving string of
- characters instead of integers. Each character will be looked up in the
- string given in the -a argument to find its value.
- If neither -r nor -c is given, the rules are initialized to random values.
- -w<width> : width should be an integer specifying the number of cells.
- The default is 79.
- -i<init string> : The initial values of the cells can be given as a
- string of characters which are translated to values in the same manner as
- the characters given in the -c argument are. If not enough characters are
- given, the rightmost cells will be set to 0. If this argument is not given,
- the cells are initialized randomly.
- -g<generations> : The number of generations to produce (and thus lines to
- print). If this argument is not given, the program will continue until halted.
- -m<mutation period> : <mutation period> should be an integer. The rules
- will be replaced with a new random set each time that the specified period
- (number of generations) has elapsed. The default is 25. If 0 is specified,
- no mutations will occur. Each time a mutation occurs, the cells are checked
- to determine whether they are all identical. If they are, the value of the
- middle cell is changed to <maxcellvalue> and the value of the cell to the
- right of the middle cell is changed to <maxcellvalue> - 1, in order to begin
- an interesting sequence again. The terminal will beep when this occurs.
- Author: John DuBois (john@armory.com)
-