This is Simon’s translation online in Cloud9: https://ide.c9.io/simontiger/smart-rockets#openfile-README.md
This is when he first discovered the bug and tried different solutions:
And this is the same project before he introduced the genetic algorithm:
In the next video Simon boasts he found two errors in his code and hopes that the problem would be solved, but alas, the rockets still vanish from the canvas after a few seconds:
Simon is officially stuck here.
On the positive side, this project did get us to read more about the actual human DNA and the way it works.
This challenge is part of the spring 2017 “Intelligence and Learning” course at NYU’s Tisch School of the Arts Interactive Telecommunications Program. Simon was especially happy to find out that Daniel Shiffman left a couple of personal comments praising Simon’s progress and offering help in pushing his code to Danniel’s GitHub repo.
Here is Simon’s translation on GitHub: https://github.com/simon-tiger/steering-behaviors-evolution
The rockets have their own DNA consisting of four genes:
The challenge step by step:
Today Simon spent hours watching videos and reading Daniel Shiffman’s book The Nature of Code, concentrating on more complicated matters than ever: autonomous agents and evolution (genetic algorithms). In The Nature of Code there are two separate chapters covering these topics. The term autonomous agent is defined as “an entity that makes its own choices about how to act in its environment without any influence from a leader or global plan”. This basically means that Simon has decided to try programming smart entities, that are like living things (have their DNA’s, behaviours, evolution).
The Autonomous Agent chapter also talks about steering force:
In the videos below, Simon has studied the steering behaviors in Daniel Shiffman’s code (Seek, Flee and Arrival) and changed the code slightly (third video) to be able to switch between the behaviours with a click of the mouse:
I also saw Simon go through the paper called Steering behaviours For Autonomous Characters by Craig W. Reynolds and reading about Persuit and Evade steering behaviours at this game development page.
In the video below Simon adjusted the Evolve Flow Field code to be able to see the possible behaviours (velocity vectors) of his smart rockets.
The code comes from the chapter Evolution of Code in Daniel Shiffman’s book, the chapter mainly devoted to genetic algorithms: it looks at the core principles behind Darwinian evolutionary theory and develops a set of algorithms inspired by these principles.
One of the most interesting notions Simon came across today was fitness, as in survival of the fittest. In the video you see Simon creating obstacles for the smart rockets. Together we observed how, as many generations of rockets passed, they learned to go around the obstacles better. This was possible because the rocket’s fitness was programmed to be greatly reduced every time it hit an obstacle.
All the rockets also have DNA’s: “We are marching through the array of PVectors and applying them one at a time as a force to the rocket”, Daniel Shiffman explains.
Simon also learned about genotypes and phenotypes, mating pool, crossover and mutation. He loved Daniel Shiffman’s example about haw many generations of strings with 18 random “genes” it would take to write “To be or not to be”.
Smart Rockets, a coding challenge by Daniel Shiffman. It involved creating a genetic algorithm from scratch and making “smart rockets” (based on a simulation by Jer Thorp). The rockets evolve the “best” path to a target, moving around obstacles. Simon got stuck half way.