-----------	MRAVENEC - simulation of ant-hive (simulace mraveniste)
-----------	v1.1 (c) Petr Baudis <pasky@pruvodce.cz> 2000
-----------	Platform: DOS/djgpp(or other C, just try), Linux/GCC
-----------	Licence: Almost public domain

Revisions:

v1.1	pasky	Public version, documentation, DOS support, comments
v1.0	pasky	Advanced, better, debug interface removed, better animation
v0.2	pasky	Basic, ugly, the mess was losing much more, debug interface
v0.1	pasky	Basic, ugly, the mess was losing, buggy move_robot()

English language:

Mravenec ("ant" in cz) is non-interactive simulation of some ants in specific
area containing some... well, mess. I'm inspired from Japanese film Living
planet, where ant's "program" is explained - there are only two points:
1. If you don't carry anything and you crash into a mess, get it.
2. If you carry something and you crash into a mess, put your carry near.
Our robots in this program does the exactly some things. It's amazing,
but in result the mess is step-by-step centralized to three, two and at end
one big center, without any coordination.

If you start the program, the initial state will be shown. '=' is a mess,
'@' is a robot, and '=' is a robot with a carry (none at initial state).
Now, press any key, and the simulation will start. On Linux/Unix, default
is paging FRAME/50ms (nice recognize and no such load), but 'tis seems that
on dos there's some problem with usleep() (i didn't check it), so the
animation is faster and so smoother. If you wan't to kill all the ants, press
^C, ctrl+alt+del, RESET or POWER. There's some error message shown, but
you can ignore it, its a tax for that murder.

Note that ant will register only mess, to which he CRASHED, not near which he
MOVED. Ant could change direction at any time. Also if the ant gets a mess and
there's another one behind it, the ant could try to go for the another one,
so he will immediatelly put the mess. He's forced to reset his directions if
he gets a mess, but there could be set the same values as before. It should
be tested, if you wanna, add it there :).

The source is very simple so the program is. The most neccessary thing is
check that the DOS define is O.K. You'll find it almost on the start of file,
between other #defines. It should be uncommented, if you use DOS, and commented
if you use Linux.
It is nice commented, so your problem shan't be there. If you'll get a problem,
tell me and we'll try to resolve it.

Give this program to all your friends and if you'll offer some CD with soft,
you have to include this program. Only you have to distribute this program at
least as mravenec.c and mravenec.txt, but you should also include executable
for linux or dos/win or both. Also feel free about modifying this program,
but not this one file (you're allowed only to ADD something here, not to CHANGE
anything), and don't forget to write about it here and to the place of program,
where you made a modification. But please try to make your modifications
portable to the other system also, or make them depending on DOS define.
Also please try to preserve ability to use the basic version of this program.
You can use a part of this program's code (i don't expect it, but... :) in
your programs, but do not forget to write about it to the credits ;). I will
be also interested about each message about interesting things that you're
doing with my program - just email me (i'm also frequently on cyberspace.cz
under id PASKY).

Note: While compiling under linux do not forget to compile with -lncurses!

Czech message:

Mravenec je jednoducha neinteraktivni simulace mraveniste v ohranicene oblasti
obsahujici nejake smeti, se kterym ti mravenci hejbaji. Inspiroval jsem se
v japonskem filmu Planeta zivota (dil hmyz), kde byl popsan "program", podle
ktereho se vlastne mravenci ridi:
1. Pokud nic neneses a narazis na kus neceho, vem to.
2. Pokud neco neses a narazis na kus neceho, poloz to co neses vedle toho.
Roboti v tomhle programku delaji presne stejne veci. Je to podivuhodne, ale
za chvili se veskere "smeti" shromazdi do nekolika center, jejichz pocet se
postupne zmensuje, az zbyde jedna obrovska hromada, a to vse bez jakekoliv
koordinace (jenom si roboti davaji bacha, aby se vzajemne neprejeli ;).

Po spusteni programu se vam zobrazi pocatecni stav. '=' je kousek neceho,
'@' je mravenec a '#' je mravenec, ktery prave neco nese (nikdy na zacatku).
Pak staci jenom zmacknout jakoukoliv klavesu a jiz staci jenom sledovat
animaci, ktera vam ukazuje deni na mravenisti. Pod linuxem je defaultni
frekvence snimek/50ms, pod DOSem je nejaky problem s usleep()em, takze
animace bezi absolutne plynule, jak to stiha tak se prekresluje. Mravenecky
zabijete pomoci ^C, ctrl+alt+del, RESETu nebo POWERu. Pri prvni variante
se vam obevi par chybovych hlasek, avsak to je jenom mala odplata za hromadnou
vrazdu.

Mimochodem, mravenci zaregistruji jenom ty odpadky, do kterych narazi, ne
vsechny, ktere minou. Mravenecek take muze kdykoliv zabocit. Pokud mravenec
sebere odpadek a za nim je dalsi, je mozne ze mravenec nezaboci, takze ihned
narazi do dalsiho odpadku, takze ten prvni zase polozi jako by se nic nestalo.
Ale to se stane jenom opravdu obcas...to.

Zdrojak je tak jednoduchy jako cely program. Nejdulezitejsi vec je
pro vas #define DOS - je to hned skoro na zacatku, pokud mate DOS/Win, musi
byt odkomentovana, pokud LINUX, musi byt zakomentovana (pred # dejte //).
Muzete si zkusit pozmenit i ostatni #define, pokud mate predstavu co
predstavuji - nanejvyse to nebude fungovat a vratite to zpatky, tak co :).
Je to IMHO celkem hezky komentovano, pokud vas bude neco zajimat nebo budete
mit nejaky problem, napiste mi...

Rozdejte tento program vsem svym pratelum a pokud prave vydavate CDcko se
softwarem, nezapomente ho tam pridat. Jenom ho musite distribuovat alespon
ve forme mravenec.c a mravenec.txt, avsak meli byste pridat i spustitelny
soubor bud pod linux nebo pod dos ci windows ci nejlepe pro vsechny :).
Klidne muzete tento program i modifikovat (ale NE TENTO SOUBOR - do tohoto
souboru muzete pouze PRIDAVAT), pokud to date na vedomi tady a na pozmenenem
miste ve zdrojaku. Ale pokuste se prosim zachovat prenosnost programu na obe
platformy, nebo alespon vase zmeny ucinte zavisle na DOS define. Zaroven,
pokud to bude mit nejaky smysl, se prosim pokuste zachovat moznost spustit
program jako v originalni forme. Muzete pouzivat casti tohoto programu i ve
svych programech (ne ze bych to cekal), jenom na me nezapomente pri
creditovani ;). Bude me zajimat kazda zprava o tom, co vsechno zajimaveho
s mym programkem delate (jsem take casto k dispozici na cyberspace.cz pod
idckem PASKY).

Pozn.: pri prekladani pod linuxem nezapomente prelozit s -lncurses!
