Skip to content

Commit 1df9d8f

Browse files
authored
Update README.md
1 parent 804a460 commit 1df9d8f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The snake can see in 8 directions. In each of these directions the snake looks f
1818

1919
## Evolution
2020
### Natural Selection
21-
Each generation a population of 2000 snakes is created. For the first generation, all of the neural nets in each of the snakes is initialized randomly. Once the entire population is dead, a fitness score is calculated for each of the snakes. Using these fitness scores, some of the best snakes are selected to reproduce. In reproduction two snakes are selected and the neural nets of each are crossed and then the resulting child is mutated. This is repeated to create a new population of 2000 new snakes.
21+
Each generation a population of 2000 snakes is created. For the first generation, all of the neural nets in each of the snakes are initialized randomly. Once the entire population is dead, a fitness score is calculated for each of the snakes. Using these fitness scores, some of the best snakes are selected to reproduce. In reproduction two snakes are selected and the neural nets of each are crossed and then the resulting child is mutated. This is repeated to create a new population of 2000 new snakes.
2222

2323
### Fitness
2424
A snakes fitness is dependant on how long the snake stays alive as well as its score. However they are not equally important, having a higher score does reward a higher fitness than a snake who simply stays alive. There is the possibility however that a snake may evolve a strategy where it loops in a certain pattern and never dies. Even though having a high score is prioritized more, if a snake can stay alive forever then that is a clear problem. To avoid this each snake is giving 200 starting moves at the beginning of its life. Every time it eats a piece of food, it gains 100 more moves. This means that snakes who evolve to go in loops will eventually die, and snakes who go for the food will not only have a higher score, but stay alive longer.

0 commit comments

Comments
 (0)