TL;DR In this article, we'll train the car to do self-parking using a genetic algorithm. We'll create the 1st generation of cars with random genomes that will behave something like this: On the ≈40th generation the cars start learning what the self-parking is and start getting closer to the parking spot: Another example with a bit more challenging starting point: Yeah-yeah, the cars are hitting so
![Self-Parking Car in 500 Lines of Code | Trekhleb](https://cdn-ak-scissors.b.st-hatena.com/image/square/eca8ccac5ddab5088b3750ba565003b8db3db1e1/height=288;version=1;width=512/https%3A%2F%2Ftrekhleb.dev%2Fstatic%2F14b49be9f15dfe3fccf2e51520529e6c%2F24a08%2F01-cover-00.jpg)