home *** CD-ROM | disk | FTP | other *** search
/ Windows Shareware GOLD / NuclearComputingVol3No1.cdr / _bbs2 / f1246.zip / TERMITE.DOC < prev    next >
Text File  |  1990-09-20  |  3KB  |  86 lines

  1.  
  2.                        --==[ TERMITE v1.0 ]==--
  3.  
  4.                             Hans Kellner
  5.                            Scottsdale, AZ
  6.                            September 1990
  7.  
  8.  
  9.      This is another little inspiration from Scientific American.
  10.      You will find the article in the Computer Recreations column
  11.      of the September 1989 issue. The program models one form of
  12.      a "Turing machine".  Watching the program in action is fun
  13.      but the most fun is received when you create your own state
  14.      table termite.  The process can be completely random or some
  15.      thinking can be applied to the states in the tables.
  16.  
  17.      The state tables for an individual Termite are contained in a
  18.      text file.  By default the program will load a state file
  19.      named DEFAULT.MIT.  You may load any other table by using the
  20.      file open menu option and then selecting a file.  Initially
  21.      there will only be one termite.  Pressing the insert key will
  22.      add new termites to the display.  The delete key will remove
  23.      them.  A maximum of 25 termites and a minimum a one are the
  24.      current limits.  This can be changed in the code.
  25.  
  26.      The format of a state table file is shown below:
  27.  
  28.         NumberOfRows NumberOfColumns
  29.         StateTable [Rows][Columns]
  30.         ColorTable [Rows][Columns]
  31.         MovementTable [Rows][Columns]
  32.  
  33.      Each table contains #Rows by #Columns elements.   An example
  34.      is shown below:
  35.  
  36.         2 4
  37.  
  38.         1 2 3 0
  39.         2 3 0 1
  40.  
  41.         1 0 2 3
  42.         2 1 0 3
  43.  
  44.         0 1 0 2
  45.         2 0 1 0
  46.  
  47.      Values are indexed from the tables by matching the current
  48.      state to the row and the current color to the column.  Values
  49.      in the state table must be in the range 0 to #Rows-1.  The
  50.      values in the color table must be in the range 0 to #Columns-1.
  51.      Note, the number of columns should not exceed the number of
  52.      colors.  There is a one to one mapping of the column number to
  53.      the color used for the termite.
  54.  
  55.      Values in the movement table are mapped as follows:
  56.  
  57.                 0 = Move forward one square (pixel)
  58.                 1 = Turn 90 degrees left, then move forward
  59.                 2 = Turn 90 degrees right, then move forward
  60.  
  61.      The cycle of a Termite is shown below:
  62.  
  63.         1) Read the current color at the current position.
  64.         2) Find the new color from the color table.
  65.         3) Set the new color at the current position.
  66.         4) Get the direction to move from the movement table.
  67.         5) Move to the new position.
  68.         6) Get the new state from the state table.
  69.         7) Loop back to 1.
  70.  
  71.     This is a rough description but there is an excellent one in
  72.     the Scientific American column.  I have included the source code
  73.     so that you may take a look at works.   I am using some of my
  74.     own graphics routines but it would be very easy to use Turbo BGI
  75.     or similiar graphics routines.  I am releasing this program into
  76.     the Public Domain world of software.  It may be distributed for
  77.     fun and thrill.  Have fun.  Note,  the author assumes no liability
  78.     in the use of this program.
  79.  
  80.                             - Hans Kellner -
  81.  
  82.     Note: Sept, 1990 - This is a modified version from my original.
  83.       It has been tweeked to run under MS Windows.  The original
  84.       used my own windowing environment.
  85.  
  86.