# Asteroids Game AI

**URL:** <https://discourse.processing.org/t/asteroids-game-ai/2113>\
**Category:** Gallery\
**Created:** [July 26, 2018, 11:41pm UTC](https://discourse.processing.org/t/asteroids-game-ai/2113 "2018-07-26T23:41:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trilobyte](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/trilobyte/32/361_2.png) [@Trilobyte](https://discourse.processing.org/u/Trilobyte)\
**Post date:** [July 26, 2018, 11:41pm UTC](https://discourse.processing.org/t/asteroids-game-ai/2113/1 "2018-07-26T23:41:38Z")

</div>

Hello!  
I wrote a sketch about a year ago that teaches simulated starships to play the game Asteroids. The program uses a genetic algorithm to train the neural network brains of the starships to play the game. Since a lot of people have been following @shiffman’s neural network and genetic algorithm guides on Coding Train, I wanted to show a practical example that combines the two. I wrote this program (including the Asteroids port) completely from scratch. I have been writing machine learning algorithms to play arcade games for a while now, and wanted to show off a good example. If you want the source code, PM me (In the future I will replace this with a Github link). I have raw footage of the program working [here](https://youtu.be/4TOBtkAPWkw)! Feel free to ask any questions about the code/my process!

- Trilobyte 🦕

 ![Asteroidssnap](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/1X/9c05f546e92b6f7e594a4370a543ee94e0feac86.JPG)

---

<div class="post-metadata">

**Author:** ![dan850](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@dan850](https://discourse.processing.org/u/dan850)\
**Post date:** [July 26, 2018, 11:52pm UTC](https://discourse.processing.org/t/asteroids-game-ai/2113/2 "2018-07-26T23:52:04Z")

</div>

This is awesome! You must have an impressive CPU to run the program for 4 hours 🙂

---

<div class="post-metadata">

**Author:** ![Trilobyte](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/trilobyte/32/361_2.png) [@Trilobyte](https://discourse.processing.org/u/Trilobyte)\
**Post date:** [July 27, 2018, 1:21am UTC](https://discourse.processing.org/t/asteroids-game-ai/2113/3 "2018-07-27T01:21:48Z")

</div>

Hah thanks Dan! Yeah, I use this computer for a lot of Python machine learning stuff so the GPU and CPU are ok! I’m glad you liked it 🙂
