home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
vol_100
/
155_01
/
oned.doc
< prev
next >
Wrap
Text File
|
1979-12-31
|
6KB
|
136 lines
/* HEADER: xxx.yy;
TITLE: ONED;
DATE: 4/30/85;
DESCRIPTION: "Documentation file for one dimensional cellular automata simulator oned";
VERSION: 1.0;
KEYWORDS: Life, cellular automata, games;
FILENAME: ONED.DOC;
CRC: xxxx;
SYSTEM: CP/M, Osborne 1;
COMPILERS: C/80;
AUTHORS: David L. Fox;
REFERENCES: AUTHORS: A. K. Dewdney;
TITLE: "Computer Recreations";
CITATION: "Scientific American, 252, 18-30(May 1985).";
AUTHORS: S. Wolfram;
TITLE: "Computer Software in Science and Mathematics";
CITATION: "Scientific American, 251, 188-203(September 1984).";
AUTHORS: S. Wolfram;
TITLE: "";
CITATION: "Physical Review Letters, 54, #8, 735-739(1985)."
ENDREF
*/
ONED -- A one dimensional Cellular automata simulator.
Copyright 1985 by David L. Fox.
All rights reserved.
Permission granted for unlimited
personal and non-commercial use
provided that this notice is included.
Oned simulates one dimensional totalistic cellular automata
as discussed in the following references:
A. K. Dewdney, "Computer Recreations", Scientific American,
vol. 252, pp.18-30(May 1985).
S. Wolfram, "Computer Software in Science and Mathematics", Scientific
American, vol. 251, p.188-203(September 1984).
S. Wolfram, Physical Review Letters, vol. 54 #8, pp.735-739(1985).
Briefly, a cellular automaton consists of an array of cells,
each of which may be in one of several states. Each cell in the
array may make a transition to a new state determined by the cell's
current state and the current state of its neighboring cells.
All cells making one simultaneous transition constitutes one
generation. The game of Life is a well known example of a two
dimensional cellular automaton.
Oned numbers the possible states of each cell 0, 1, 2, ... 9
and allows neighborhoods of up to 10 cells on either side of a
central cell. Totalistic refers to the fact that transitions
to a new state are determined by the total value of the states
of all cells in the neighborhood (including the value of the
state of the cell making the transition). If an automaton has
s states and a neighborhood of (2*r + 1) cells it is defined by
a transition table containing s*(2*r + 1) entries, each of
which is the value of the new state corresponding to a given
total of the neighborhood.
When oned is run it responds with a colon (:) and waits for
the user to enter a command. The following commands are
recognized:
? Print a summary of commands.
a Print the definition of the current automaton. (Number
of states, size of neighborhood, and transition table.)
d Display the current state of the cellular automaton as
one line on the screen. Cells in state 0 are represented
by blanks, states one to four by Osborne 1 graphics
characters and states five through nine by the
corresponding digit.
e Define or modify the state of the automaton. This command
invokes a simple one dimensional screen editor. Typing any
digit (0-9) changes the state of the cell pointed to by the
cursor (^). The cursor is moved using the arrow keys or by
^S or ^H for left and ^D or ^L for right. Pressing z will
zero every cell in the universe. Any other key will exit
from the editor and return to command mode.
n=xx Compute and display the next xx generations.
xx represents an integer between 0 and 32767, inclusive.
Pressing return displays the next generation,
equivalent to the command n=1. If you enter n=20000
when you meant n=20 pressing ^B will stop the
simulation and return to the command prompt (:).
The display origin may be shifted during the course
of a simulation by pressing the arrow keys. This
will cause the display to jump around and makes
stationary objects look like gliders.
o=xx Sets the origin of the display window to cell xx. The
origin is the left most cell displayed by the d or n
commands. This command in needed to view the entire
universe of 250 cells, too many to display at one time
on the screen.
o+xx Similar to o= except that xx is added to or
o-xx subtracted from the current origin.
r=xx Sets the size of the neighborhood (region) to include
xx cells on either side of a central cell (2*r + 1)
cells.
s=xx Sets the number of allowed states to xx.
t=code Defines the transition table. The decimal number code
is converted to a representation in base s. The i th
digit in this representation (counting from the right)
is the value of the next state when the neighborhood
total is i.
txx=yy Alternative method of defining the transition table one
entry at a time. The next state is yy when the
neighborhood total is xx. More than one entry can be
specified in one command:
t1=0,2=0,3=1,4=0,5=1,6=0
is equivalent to t=20 for a r=2, s=2 automaton.
x Exit from oned and return to CP/M.
Portability considerations: Oned is written in C for
Software Toolworks C/80 compiler. The only non-standard
features used are CtlCk(); and int (*CtlB)(); which implement
the ability to catch the ^B software interrupt.
The screen control sequences used are those for the
Osborne 1. They are implemented as #define 'ed constants
and may be easily changed to accommodate other computers
and terminals. The characters in the array stsym will
probably also have to be changed.