Search Wiki

Simple AI – Self learning car

What this tutorial will cover:

  1. Who is this tutorial for?
  2. Links to video-tutorial, source code
  3. Setup
  4. Parts 1 to 6: Following along with video tutorial 
  5. What’s next?

[1] Who is this tutorial for?

This tutorial is for you only if:

  1. You have a ready to use IDE.
  2. You have some basic knowledge of CSS, HTML and JS.
  3. You have some spare time for learning basics about how AI works.

At the end of this tutorial you should have a basic car, navigating and avoiding walls.

It will start by driving randomly into walls, but learn over time.

Here is how it looks after only about 5 minutes of running:

[2] Links to video-tutorial, source code

Here is the video-tutorial we will be covering in this tutorial. It comes in 6 parts.

The first one can be seen here: 

Links to 2 to 6 can are attached here: Part 2, Part 3, Part 4, Part 5 and Part 6.

The source code can be downloaded from: Here.

[3] Setup

To see the final solution, download the source code linked above,

And open the important files in a new project in your IDE of choice, these are: “d”, “index.html”, “main.html”, “main.js”, “script.js” and “style.css”.

It should look like this:

Recommendation:  To get a general idea of what you will be building, set up the source code as a project, open it in a browser to see what you will be building,

and then start your own project.

Open the video (Starting from “Part 1”), and follow along.

[4] Parts 1 to 6: Following along with video tutorial 

Part 1:

Here we are getting the basic file structure, and CSS into play. You will start to see how it will look like, but it is all static at the end of this part.

Part 2:

Now we are getting elements to move, in particular getting the wall to move towards the car.

Part 3:

Building up the walls (check collision).

Part 4:

Mostly improvements.

Part 5:

AI starts to be defined here! Defining the different states.

Part 6:

Calling the database of experience, closing up.

 

[5] What’s next?

  1. I really recommend reading this simple tutorial on how to build a simple ‘Neural Network’ in 9 lines of Python.
  2. Since a great deal of AI is done in Python, this ‘Getting started’ Udemy course for Python and AI is very good.
  3. Moving to heavier stuff: This Coursera course on Machine Learning covers more than just the basics. It is also free.
  4. There is also a course on Udemy that teaches how to recognize objects in images! This is a major step towards the logic behind DDG.