home *** CD-ROM | disk | FTP | other *** search
-
- --==[ TERMITE v1.0 ]==--
-
- Hans Kellner
- Scottsdale, AZ
- September 1990
-
-
- This is another little inspiration from Scientific American.
- You will find the article in the Computer Recreations column
- of the September 1989 issue. The program models one form of
- a "Turing machine". Watching the program in action is fun
- but the most fun is received when you create your own state
- table termite. The process can be completely random or some
- thinking can be applied to the states in the tables.
-
- The state tables for an individual Termite are contained in a
- text file. By default the program will load a state file
- named DEFAULT.MIT. You may load any other table by using the
- file open menu option and then selecting a file. Initially
- there will only be one termite. Pressing the insert key will
- add new termites to the display. The delete key will remove
- them. A maximum of 25 termites and a minimum a one are the
- current limits. This can be changed in the code.
-
- The format of a state table file is shown below:
-
- NumberOfRows NumberOfColumns
- StateTable [Rows][Columns]
- ColorTable [Rows][Columns]
- MovementTable [Rows][Columns]
-
- Each table contains #Rows by #Columns elements. An example
- is shown below:
-
- 2 4
-
- 1 2 3 0
- 2 3 0 1
-
- 1 0 2 3
- 2 1 0 3
-
- 0 1 0 2
- 2 0 1 0
-
- Values are indexed from the tables by matching the current
- state to the row and the current color to the column. Values
- in the state table must be in the range 0 to #Rows-1. The
- values in the color table must be in the range 0 to #Columns-1.
- Note, the number of columns should not exceed the number of
- colors. There is a one to one mapping of the column number to
- the color used for the termite.
-
- Values in the movement table are mapped as follows:
-
- 0 = Move forward one square (pixel)
- 1 = Turn 90 degrees left, then move forward
- 2 = Turn 90 degrees right, then move forward
-
- The cycle of a Termite is shown below:
-
- 1) Read the current color at the current position.
- 2) Find the new color from the color table.
- 3) Set the new color at the current position.
- 4) Get the direction to move from the movement table.
- 5) Move to the new position.
- 6) Get the new state from the state table.
- 7) Loop back to 1.
-
- This is a rough description but there is an excellent one in
- the Scientific American column. I have included the source code
- so that you may take a look at works. I am using some of my
- own graphics routines but it would be very easy to use Turbo BGI
- or similiar graphics routines. I am releasing this program into
- the Public Domain world of software. It may be distributed for
- fun and thrill. Have fun. Note, the author assumes no liability
- in the use of this program.
-
- - Hans Kellner -
-
- Note: Sept, 1990 - This is a modified version from my original.
- It has been tweeked to run under MS Windows. The original
- used my own windowing environment.
-
-