## Sunday, 2 March 2014

### Intelligence Level 2

Video 4: Intelligence level 2

In video 1 we commented on the simpliest way to implement the entropic intelligence on a kart: count how many different end points you have in the futures that start by chosing "+5", and compare with the number you get for choice "-5", then average and take this as your decision. We will call this "intelligence level 1".

But as simple as it seems, almost every aspect of the AI explained on video 1 can be redefined so the driving of the AI "looks" more natural, as if the driver were a real driver doing his best.

By the way, chosing a kart simulation as a test-bed for the algortihm as proven to be a really good choice, as it is very easy to just observe two kart driving side by side, each one with a different version of the AI, and tell witch one of them was doing a better job. It wouldn't have been that easy with another simulation.

So, steeping over video 2 and 3, that just show intelligence level 1 solving different circuits -you can watch them on the "YouTube" link avobe- we jump to video 4, the first one to really level up intelligence to level 2:

In the first video (level 1), I chose to only count as good those futures that didn't end up on a crash with the circuit limits, and I commented it was a really bad decision, so now we come again at this point.

Discarding those futures was a bad decision for a couple of reasons. The most evident one is that as you increase the number of seconds you simulate to get a future, the more futures will end up crashing, as the futures are found by simulating a random drive, and long random drives tend to easily crash. So using 20 seconds was a silly way to discard all the futures and have a kart unable to take any decision at all. This was bad.

But the second reason is more general: when calculating an entropy you have to count all possible cases, you can not discard micro states just because they look ugly to you. By doing so, you add some human stupidity on the AI, and you get stupid decisions.

In this video 4 avobe, all futures are considered as valid, and crashes near the initial position count as much as another future in witch you manage to run all 10 seconds without crashing. Still it is not fair, but as you can see, now the kart is much more agile driving.

I used to make an joke with my wife -she is psicologist- about how I become some kind of weird "kart's psicologist", as I spend a lot of time thinking about why did the kart drove this way instead of doing it right.

In thi case, removing the futures where the kart crashed is equivalent to being afraid of dying for a human. Well, kind of. And counting on all futures without judging them made the kart to drive touching the circuit limits instead of avoiding the limits at any cost.

Sure there is some deep lesson on this!

Also, in this case the AI have two "degrees of freedom", or joysticks, to move: AI was able to turn left or right as on video 1, but also accelerate or brake at will.

One thing that stoned me at first, when I introduced the accelerator to the AI, was the kart initally deciding to accelerate fast and start running. Why? I didn't tell it anything about running being a goal! The AI decided to do it by itself.

It is clear when you think with entropy in mind: if the kart stay still, it only have one possible future, being in the same place. But if you push the accelerator now, in 10 seconds you can be at many different ending points. So if you make the numbers, accelerating will has a much biger weigth that braking.

So, level 2 of the intelligence is as level 1, except you can not discard any of the found futures, and the resulting AI is, visually, much more near to doing it right at driving... but still far from optimal.