Old-School Simulation Inspired by Genetic Algorithms – I

Back in the day, I spent several years studying Genetic Algorithms.

The Gentlemen Scientists have a foggy recollection, but are fairly sure they first came across genetic algorithms in an article in the July 1992 Scientific American, written by the father of Genetic Algorithms, John Holland. It was simply entitled Genetic Algorithms.

John described a lot of things that I, as a high school student, didnt understand at the time. But I understood the concept that solutions to a problem can evolve over time, and that really blew me away. What a great idea. Parent solutions get together and have children. The children takes information from each parent. Then the best adapted children would have a better chance of survival in the environment, which was the problem space being explored.

At the time, the Gentlemen Scientists were heavily into GW Basic programming on the family 386 PCs. Hours of fun were had writing programs that drew pictures at either 640×480 with 16 colours, or 320×200 with 256 colours. SCREEN 12 and SCREEN 13 for the win.

We wanted to try out John’s ideas, but what problem could we solve using these marvelous Genetic Algorithms? We decided to combine our GW Basic programming prowess with a sun-smart message. If you don’t want to die of skin cancer, you have to wear a hat and big sun glasses.

We wrote a graphical program that depicted little figures called morphs. Some were male, some female. Little white dots would flit on the screen. These were harmful UV rays. If they touch pink skin, then the morph would surely die.

The population of morphs can adapt. If individuals inherit the gene for a hat or the gene for large sun glasses or the gene for thin cheeks, then they are more likely to survive to pass on their genes to the next generation. Hence these beneficial traits become more wide-spead in the population.

The program was written in microsoft quick basic 4.5, probably in DOS 5. It used some x86 turbo assembler libraries to speed up the graphics, which were supplied by a friend.

This was a lot of fun to write, back in the day. The implementation of the underlying Genetic Algorithm was not to John’s original specification. He doesn’t have male/female. Nor does he have a spatial relationship between individuals. In our simulation, the morphs only mate and produce an egg if a male and female get close to each other. Very inefficient, but fun.

Watch the video from a run of the simulation, which was run and video-captured on a modern PC using dosbox.
Switch to full screen at 480p, and you’ll feel like it is 1992 all over again.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s