PDA

View Full Version : Ants


Martin_S
02-09-2009, 08:30 PM
Hello,
I programmed a little application with the Windows API, not with GAPI, because GAPI seems too hard for me.
The program is called ´Ants´ . It only runs in landscape modus (320 x 240).
I programmed it for my HTC Touch Pro with Windows Mobile 6.1 and it works fine.
It also works fine on an MDA Pro with Windows Mobile 5 from T-Mobile.

1 to 200 little ants move around the plane.
The rules for each ant are the following:
In every time step the ant goes one cell forward.
If it meets a yellow cell it changes the cellcolor under it to red and turns right.
If it meets a red cell it changes the cellcolor under it to yellow and turns left.
This ´game´ist famous under mathematicians and there are several unproved properties of the game.

If one push the Reset-button, the plane is cleared and a red circle and a red square is painted.
The program gets the number n% of ants and the number ItAnz% of iterations from the 2 textfields.
It sets n% random coordinates and random directions for the n% ants.

If one push the Start-button, the systems shows the following ItAnz% steps of the game.

If one compile it to an exe file the program runs about 4 times faster than running it directly from the
Pocket PC IDE.

The program is not optimized. If one could optimize it, it would be great.

Regards
Martin_S

Nicknack
02-11-2009, 03:37 PM
I have a problem with the buttons, they are invisible until I clicked them once by assumption. Besides thanks for share, haven't heard from this type of simulation before :)

Martin_S
02-11-2009, 06:53 PM
Hello Nicknack,
thank you very much for your reply.
I have the same problems with the buttons when I start the application on my Windows PC.
The buttons are invisible.
But when I start it on my Pocket PC the problem all works correct.
I don´t know the answer for this malfunction, because I´m a really newbie in PPL.
Perhaps anyone in the forum can solve this problem.
Martin_S