• About
  • Contact
  • Home
  • House music
  • Links
  • Portfolio

Portfolio

You're looking at the portfolio of Liudger Wijbenga. I invite you to leave behind your thoughts, questions or remarks, it's greatly appreciated!

Flash Programming

Genetic Algorithm

Year: 2006

I have always been interested in AI (Artificial Intelligence), pathfinding, and so on.

What's shown here is called a 'Genetic Algorithm'. It can be put to various uses, but in this example you type in a target number, and the GA tries to find a sum to make the target number.

The Genetic Algorithm tries to find a sum that, if read and operated from the right to the left, matches the target value. I decided to challenge myself and make it work under Flash MX, with help of the sample C++ code found on the mentioned site.

On the start of the program random genes are generated, and are run through various processes (functions), including survival of the fittest, a roulette wheel selection, mutation, and so forth. When the number of generations increases, it is likely the GA comes closer to the target value. The fitness of a gene is calculated by how close the gene sum value is to the target value. If a gene's sum matches the target value, the fitness score is set to 999 and the winning gene is decoded, and shown to the user as a sum.

I used http://www.ai-junkie.com and the sample code there to write this program in Flash MX. It's still somewhat sloppy and not properly coded (if you're a programmer and want to have a laugh, please do have a look at the code!), but I wanted to share it with you anyway.

And my sincere apologies for the hideous design and colors, not really friendly on the eyes now is it?
View Genetic-Algorithm.swf Download Genetic-Algorithm.swf Download Genetic-Algorithm.fla

blog comments powered by Disqus

Please keep in mind that this page only shows a small portion of my work, if you want to see more, you can click here to see all my portfolio work on a single page.