Genetic Algorithms: Self-Driving Cars

(Applies next gen)
Generation: 1
Best Reward: 0
Alive: 25

Project Overview

A from-scratch implementation of a Genetic Algorithm training a Neural Network to drive a 2D physics vehicle. Each car has five "vision" sensors (raycasts) to detect walls. The Neural Network processes these distances and outputs a steering angle using a Tanh activation function.

Cars that drive the fastest and furthest gain the highest reward. At the end of a generation, the best-performing cars are selected to "breed" the next generation, passing on their neural weights with slight random mutations. The absolute best car is passed to the next generation unchanged (Elitism) and is highlighted in gold.