Javascript Artificial Intelligence Tutorial – For beginners

Here is a simple Javascript A.I. tutorial for beginners using the reinforced learning method. You need to have basic knowledge on HTML, CSS and JavaScript, as well as programming basics.

This tutorial is a starting point for people who want to implement A.I. in their projects. You are free to “steal” ideas and techniques from this :)

In this tutorial we will create a car with an A.I. driver, which will drive along a road avoiding obstacles. The avoiding will be made by the A.I. and not by direct programming (like using IF-statements).

There are multiple ways to achieve this, but this is just my take on it, and you should research how other people versions too.

Thank you for your interest in this, let’s start!

Code at jsfiddle:

Part two:

Code at jsfiddle:

Part three:

Code at jsfiddle:

Part four:

Code at jsfiddle:

Part five:

Code at jsfiddle:

Part six:

Code at jsfiddle:

Project at github:

8 thoughts on “Javascript Artificial Intelligence Tutorial – For beginners

    1. It’s just my way of implementing A.I. with JavaScript for this particular task. You can achieve the same result in so many other ways.

  1. Hi, I just finished watching your tutorials, I copied your code on Sublime Text 3 and opened in chrome and it didn’t work: there are this error messages “Uncaught TypeError: Cannot read property ‘offsetLeft’ of null at moveWall at tick” when I click the start button and “Uncaught TypeError: Cannot read property ‘style’ of null at runSim” when I click the stop button. I don’t know why it doesn’t work, I’ll be very thankful if you reply and explain to me how to fix the program.

Leave a Reply

Your email address will not be published. Required fields are marked *