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: https://jsfiddle.net/niandrei/durho073/

Part two:

Code at jsfiddle: https://jsfiddle.net/niandrei/6gn7m7uu/9/

Part three:

Code at jsfiddle: https://jsfiddle.net/niandrei/6gn7m7uu/13/
 

Part four:

Code at jsfiddle: https://jsfiddle.net/niandrei/6gn7m7uu/21/
 

Part five:

Code at jsfiddle: https://jsfiddle.net/niandrei/6gn7m7uu/27/
 

Part six:

Code at jsfiddle: https://jsfiddle.net/niandrei/6gn7m7uu/33/

Project at github: https://github.com/NiscoveanuAndreiPFA/JavaScript_AI_ReinforcedLearning
 

Share this:
error

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 *