After reading through this week's genetic algorithm prompt, I was especially fascinated by Professor Shiffman's pathfinding example. The way the agents were able to evolve over time to adapt to new paths around the obstacles was reminiscent of lab mice learning the route of a maze. Immediately, I thought of creating an apocalyptic scenario to 'root out' the best of the best, and to evolve an agent into the most adaptable, versatile survivor. 

Scenario:
The population would be the number of Survivors, which will be denoted by a set of objects within an array. Each Survivor object will be represented by an ellipse, and will contain p5 vectors for acceleration and velocity, as well as a variable for position. The environment is an enclosed maze, with Enemy agents roaming the maze in a preset route. Each Enemy object is identical to the Survivor object, except that they will be restricted to certain paths within the maze. The goal is to train the Survivors to complete the maze without coming into contact with the Enemies, and the ultimate Survivor will be able to finish the maze utilizing the most efficient/shortest route possible to the exit. ​​​​​​​

Environment would be similar to Pac-Man, with the exception of pellets. 

Phenotype & Genotype:
The "thing" that is evolving is the Survivor object. Essentially, the Survivor will attempt to find the shortest route to the maze exit, taking into account the movement of the Enemy path. Therefore, its 'phenotype' will be expressed by its movement throughout the maze, and its ability to dodge the Enemy to get to the exit. The object's 'genotype' will be an array of vectors, which will then be applied as a force in the object's built in physics engine. This is noticeably the same technique that is used in Professor Shiffman's pathfinding example, where each agent is a physics object with the DNA built into it. To avoid the Enemy, I assume that I would need to apply the concepts of attraction and repulsion in my previous assignments, so that if a Survivor were to be going towards an Enemy, and the Enemy is also moving towards the Survivor, the Survivor object would move away or be 'repelled' from the Enemy. This would result in the Survivor having to find another path to the exit. 
Fitness Function:
The Survivor's fitness will be determined by its ability to solve the maze using the shortest route possible (which also corresponds with solving it in less time than other objects). Given the fact that the obstacles (Enemies) are moving throughout the environment, a Survivor at peak fitness will be able to avoid each Enemy and reach the maze destination successfully. 
Mutation & Crossover:
In terms of mutations, I could see a situation where a Survivor Object could roam the maze without reaching the exit, but continue to dodge the Enemy successfully. Therefore, this type of Survivor object has technically 'survived', but will never be able to each the ultimate goal of exiting the maze. On the other hand, I could also think about the possibility of having the Enemy objects mutate, meaning that the Enemy would be able to change its path in the maze, rather than stick with the same, repetitive route. It would be interesting to have the Enemy object evolve as well, so that they will keep adapting to better catch the Survivor, while the Survivor will keep evolving to avoid the Enemy.
Back to Top