I use raycasters to help alert the neural net. With the AI snake games I have seen, you can hardcode it’s environment. I used raycasters instead since I think it could extend past the grided 2D example. Maybe one day I’ll try to make more complicated models that travel 3D.
The neural net visual. I think threejs could easily plug into large python neural net models and make cool visuals.
I have two versions. A local site where I I trained it using a python backend connected to threejs via websocket.
I used this repo for a basis of the python model. There is also a very good youtube video where he breaks it down.
Then this second (published) site where I transferred over the numpy matrices as JS arrays and perform the dot products and activation functions inside the javascript loop.