[Windows Mobile Apps and Games] stephj:
‘Life’, as per John Horton Conway’s original creation. It simulates the existence of a two dimensional array of cells which will continue, or not, into the next generation based on a few simple rules. Which are:

If a cell has two or three neighbours, it will continue into the next generation. If an empty square is surrounded by three neighbours, then a new cell will be ‘born’ into it on the next generation. In all other cases which is where a cell has less than two or more than three neighbours, then the cell will die, simulating a lack of breedable neighbours, or lack of food due to overcrowding, respectively.

These simple rules create a complex world, where order and chaos reign, and quite often change places with each other, before finally settling down to a stable or completely static state, sometimes after hundreds, if not thousands, of generations.

The program is a Win32 C++ implementation in an executable of only 13Kb in size, although it consumes around 200Kb of memory when running. It uses basic GDI drawing functions so it will run on any ARM powered Pocket PC or Smartphone, from WM2003 onwards. Just drop the executable on your device and run it. It will also run on any sized screen up to 1024x1024 pixels, so that should take care of all current devices. It matches the grid size to the screen size. Cell populations cycle every half a second.

The original population is a randomly generated, with a one in four chance of a cell being present, after that the above rules take over.

MENU OPTIONS:

Restart will regenerate another random selection.

Auto Restart will make an intelligent guess that the population has reached a stable or static situation and will automatically restart after around 20 seconds of such a situation being reached. It has a reasonable attempt, but it cannot spot all possible stable or static situations.

Start Edit: Stops the generation and allows you to edit the cell pattern.

Pocket PC: - Tap the screen to create or remove a cell.

Smartphone:- Use the D-Pad to move the inverted cursor to the required square and press the centre Enter button.

Clear will erase all cells.

Run restarts the generations.

Wraparound removes the bounding effects of the edges of the display. When selected, cells' affects are allowed to roll over, left/right and up/down. The display, in effect, then becomes part of an infinitely repeating pattern.

Pressing the OK button does not terminate the program. Select End Program to close it completely.

If you have a Wizard, Kaiser or similar device, where the display can be switched from portrait to landscape, and if you do so, the program will continue, but you may invoke a near catastrophic extinction, as the display gets realigned to the new layout.

For a more complete article on this topic, have a look at:-

http://en.wikipedia.org/wiki/Conway's_Game_of_Life

The samples image shows a few shapes to try. They are the glider, the R pentamino, the spinner and the 10 consecutive cells. The R Pentamino generates a chaotic pattern of many cycles before it settles down, all the others are static/cyclical patterns. Auto Restart cannot detect the 10 consecutive cells, the repeating pattern is too complex for it to spot.

Update: 17/06/2011 Version 1.1 fixes the Embedded C++/WinMo 6.5.3 Dialog Box issue mentioned in

http://xdaforums.com/showthread.php?t=635063

If you are running Winmo 6.5.3 and you downloaded this before 17/07/2011, you will need version 1.1 in the zip file below.

UPDATE: CE Version added.

If you have bought an ARM powered Windows CE device and are thinking

"What the hell do I do with this?!!"

try the CE version, then you can think,

"What the hell does this do?!!!"

Do not run the CE version on your SmartPhone or PPC device, the display will look awful. The same applies to running the Mobile version on a CE device, but try it if you must. An extra caveat is that your CE device should be running a version backwardly compatable with the Embedded C++ 4.0 'Standard' SDK

P.S. I wrote this program originally to run under DOS, over twenty years ago. It was written in 8086 assembly language, as it was the only way to get it run fast enough on a 12Mhz 80286, and drive an 640x480 mono VGA screen fast enough for it not to look awful. These days, on a current Intel Core class processor, the same program now runs through hundreds of generations per second, rendering it almost useless. Even though the program is now ported to C++ under a completely different platform, some of the original code optimization methodologies remain. They still work!