Dec 142017
A Life-type program that runs under Windows 3.0. Includes C source.
File TERMITE.ZIP from The Programmer’s Corner in
Category Windows 3.X Files
A Life-type program that runs under Windows 3.0. Includes C source.
File Name File Size Zip Size Zip Type
CRYSTAL.MIT 119 57 deflated
DEFAULT.MIT 119 57 deflated
FILEOPEN.C 7510 1836 deflated
FILEOPEN.H 229 130 deflated
FILEOPEN.RC 622 313 deflated
MITE1.MIT 40 28 deflated
MITE10.MIT 119 57 deflated
MITE2.MIT 30 19 deflated
MITE3.MIT 74 43 deflated
MITE4.MIT 28 15 deflated
MITE5.MIT 931 292 deflated
MITE6.MIT 47 27 deflated
MITE7.MIT 43 25 deflated
MITE8.MIT 40 25 deflated
MITE9.MIT 67 41 deflated
TERMITE 620 235 deflated
TERMITE.C 5936 1971 deflated
TERMITE.DEF 269 206 deflated
TERMITE.DOC 3410 1357 deflated
TERMITE.EXE 22528 7889 deflated
TERMITE.H 1497 617 deflated
TERMITE.ICO 766 328 deflated
TERMITE.RC 1052 486 deflated
TERMTOOL.C 8996 2399 deflated

Download File TERMITE.ZIP Here

Contents of the TERMITE.DOC file

--==[ 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.

 December 14, 2017  Add comments

Leave a Reply