Merry Christmas (or Happy Holidays) with LiveCode fun!

Jeffrey Massung massung at gmail.com
Sat Dec 25 01:59:38 EST 2010


I decided to put together a little fun stack for everyone here to play with. It's something I do in my spare time (yeah, what's that?!) for fun: genetic algorithms. I've done all sorts for random experiments, but today on Reddit I saw that someone had made a decent tutorial of them, and I thought to myself, why not toss something together for the Rev community using LiveCode real fast and see how it turns out? Well, below is a link to the stack that's made. It's dead simple (nothing flashy or fancy), but it gets the point across. 

* All the "interesting code" and comments is in the card script. Just open it up, have a look, and enjoy. Try making some changes and see what happens!

* The top field is the "target" - that's the problem the computer will be trying to solve (reproduce that phrase). It's pre-seeded with some holiday cheer, but feel free to make it whatever you want.

* Click "clear" to start over.

* Click "step" if you'd like to see the algorithm work generation by generation.  Keep in mind, evolution takes time, so aside from the first few clicks, or some steps later on in the process, this will generally be uninteresting to watch.

* Click "run" to continue from where-ever you are and continually step the generations. You can pause at any time (click the "run" button again) and continue stepping, and continue running again.

* I make no guarantees about odd targets (like empty ones) or what would happen if you change the target in the middle of running (although I have tried it and it is kinda funny to watch!).

* Please don't credit me and do feel free to use any of this code or anything you find it in within your own work. I learned everything I have with the help of many others, and none of this code is hardly special.

* ENJOY! AND MERRY CHRISTMAS/HAPPY HOLIDAYS!

http://www.sqwerly.com/files/genetic_algorithm.livecode

Jeff M.



More information about the use-livecode mailing list