System 4 Genetic Algorithm Simulator

V alpha-1

This is a genetic algorithm engine, slightly different from my previous
attempts. I has a "playing field", currently 80x80 on my machine, and in
each cell an organism can live. They are chosen at random and they fight
their neighbours (if they have some) and reproduce into free
neighbouring cells (if there are any). This implementation does not do
recombination, only mutation. After a fight even the winning one can die
if the MINSCORE is higher then it's score. Minscore increases by a set
percent of the difference between MINSCORE and MAXSCORE, so it will
approach MAXSCORE. This will make the "enviroment" be harsher every once
in a while, more closely emulating how evolution worked on earth. And it
will create better warriors though time.

When a new organism is produced it inherits the name from it's parent so
that you get some idea of "family" names. It will have it's position tacked
on the name.

Also note this implementation uses memory to store the warriors. It will
only write them to disk after a certain amount of fights, or when sent
the HUP signal. It will save and quit when sent the INT signal is sent.
Though do not press ^C on the console since it can hang sys4, rather use
the ./stop.sh script from another console. For writing to disk without
quitting use the ./backup.sh script.

Note that for an 80x80 size field it will take up around 6-8M. It will be
around 8 meg the first time you start it since the array is full at that
time. It should drop to around 6M the second time around.

Before running edit the config.pl file for some options.

To run:
(if any previous warriors, remove the warriors directory, ./cleandir.sh
does this)

./makerand.pl
./sys4.pl

And that's it. You might want to nice down sys4.pl so that it doesn't take
up too much of your CPU time when you need it.

Output from sys4.pl can be redirected to /dev/null if running in background
since it is not really important. (errors are sent to stderr)

programs and descriptions:
./cleandir.sh	- removes the previous warriors/ directory
./makerand.pl	- creates random batch of warriors in warriors/
./sys4.pl	- the actual GA program
./stop.sh	- stops sys4.pl with the INT signal (safe) and sys4 will
		  write all warriors to disk.
./backup.sh	- sends sys4.pl the HUP signal to write all warriors to disk.
./map.pl	- makes a map of the field from the first two letters of the
		  warrior names or two blanks, it won't look good on small
		  terminals so make your xterm display in small font and
		  have about 160x81 resolution to see the whole thing (with
		  80x80 field that is)
./eval.pl	- display cumulative average scores for warriors.
./eval.sh	- sort the scores and display the top ten.
./config.pl	- NOT a runnable program, it's the configuration file.

Changes since System 3:
	- no corner enviroments! (this seemed like a stupid idea from what
	  it produced)
	- cutoff at a certain score
Changes since alpha-1 (system3):
	- scoring now actually works
	- score is averaged across about 10 fights (edit config.pl to change
	  it)
	- less memory usage (dynamic warrior creation) ...
	- small code cleanup
	- TERM signal also causes disk write before exit
	- fixed accute memory leaks, but memory is an inherent perl problem
	  so now the process is restarted everytime a backup is invoked
	  (default 3000 fights)

TODO:
	- fix the ^C thingie to make it work
	- make the corners dynamic
	- write some interface so that monitor programs can be written,
	  probably with sockets
	- make the mutation proccess better
	- spawn off separate proccess for writing to disk
	- make it possible to run multiple fights at once to make it run
	  faster on SMP machines
	- add support for communications with other System 3's
	- fix a memory leak that just killed my field. the restarting backups
	  should at least walk around teh problem

COPYRIGHT:
	Under the GPL (General Public License), read ./COPYING!

George Lebl <jirka@5z.com>
