Project Title: Smart Rockets
Date: Summer, 2006 Project Link: http://www.blprnt.com/smartrockets
This project is a fun little demonstration of genetic algorithms. A population of rocketships attempt to find their way to a a target, avoiding the white barriers and using as little fuel as possible. The best performers from each generation are (usually) selected as parents for the next batch of rockets. Each rocket has a set of jet engines (the default is 8), arranged at different angles around the ship. Each engine has a binary firing pattern, which is initially random.
As you'll see if you give it a try, the first generation is generally fairly disastrous. However, by 2 or 3 generations, almost all of the rockets are remaining in the air. After 9 or 10 generations, they are making some progress:
When the settings are right (I find a mutation rate of about 0.05 works best), they will eventually find the ideal path to the target. If you let the system run for long enough, you should see the rockets find a fairly good path:
Note that this is not a perfect GA implementation. It was thrown together fairly quickly and there are some issues with collision detection at high speeds. I'm sure the GA itself could also be tweaked to function a bit better. Still, it's fun. And, there are rockets!
Here are some things to try:
- Try adjusting the mutation rate to either very high (1.0) or very low (0.0). What happens?
- You can also adjust the length of the firing pattern, the amount of fuel that the rockets get, and the size of the engines.
- Pressing the arrow keys will cycle through a small set of different barriers.
SmartRockets was built in Flash, using ActionScript 2.0.