DEV Community

Cover image for Excuse me, would you let my Neural Network drive?
Victor Ribeiro
Victor Ribeiro

Posted on • Originally published at


Excuse me, would you let my Neural Network drive?

Excuse me, would you let my Neural Network drive?

A Neural Network experiment involving a JavaScript game: can a perceptron drive a car?


A live version of the code is hosted here


Not so long ago I published the simplest perceptron you'll ever see, code I wrote after a machine learning class, a while back. Ever since that I've been meaning to do something cool with it. So, browsing some more old codes I found a little game I made when I was studing fake 3D perspective, so I thought: can my perceptron play this game?

So I gave the game code a little brushing, wrote some more code to capture the data of me playing it (I played until I got a score of 33 points) and feed it to my neural net. After that I just played with the learning rate and iterations and let it play the game on it's own.

A Neuroevolution you say? Yes, I thought about that. I have a fully conected multilayer perceptron, that I'm about to realease, So I'm saving the ideia of evolving a neural net with genetic algorithm for that.


If you have any questions about the code or how I implemented it, or even how I got the data to feed the neural network (features), please feel free to contact me. (I left some comments on the code)

You can take a look at the code here

Top comments (0)