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).
Thank you for your interest in this, let’s start!
Code at jsfiddle: https://jsfiddle.net/niandrei/durho073/
Code at jsfiddle: https://jsfiddle.net/niandrei/6gn7m7uu/9/
In this second part we’ll create some functions which will move the wall towards the car.
Code at jsfiddle: https://jsfiddle.net/niandrei/6gn7m7uu/13/
In this third part we’ll create some functions which will move the car down when one of its sensors collides with the moving wall.
Code at jsfiddle: https://jsfiddle.net/niandrei/6gn7m7uu/21/
In this fourth part we’ll improve the collision detection and move the debug area, and also add some new things to it.
Code at jsfiddle: https://jsfiddle.net/niandrei/6gn7m7uu/27/
In this fifth part we’ll split the road into two imaginary zones, and construct a ‘database’ that will hold all the possible positions the A.I. and the wall can have in those two zones.
Code at jsfiddle: https://jsfiddle.net/niandrei/6gn7m7uu/33/
In this sixth part we’ll finish by making the AI avoid the wall by using its experience.