Snake AI: A final school project with Three.js, Tone.js & TensorFlow.js

Hey guys, for my final school project I developed a snake AI with reinforcement learning that actually wins the game. I used three.js to create the frontend and tone.js for the sound and music. The particles are created with THREE.BufferGeometry and THREE.PointsMaterial. Any feedback?

Demo:

Screenshot:

6 Likes

Awesome :slight_smile:

Agree. This is freakin awesome. Does it generalize to different board sizes too, or would that require retraining?

Hhaha just saw the end… ESCAAAPE!!! A+++

1 Like

I assume that it would also run on other board sizes, as it was not trained with the board as input. Haven’t tried it though! Thanks for your feedback.

1 Like

That’s very cool! Great work!! - I couldn’t watch the video with audio for reasons, so I might have missed it. But how did you go about training it with reinforcement learning if I may ask? Is there a tutorial somewhere perhaps?

I used Deep Q-Learning with Tensorflow, which leverages the GPU acceleration in the browser. Still took a day to train on my pc. I haven’t seen any decent tutorials on reinforcement learning with Tensorflow.js tbh

1 Like

Kudos, a very interesting project and well executed

1 Like