## Tuesday, 25 March 2014

### The new intelligence level 7

For the 3rd or 4rd time, I think the new improvement in the base intelligence algorithm can be the final one, so let be cautious on this: may be the new AI level 7 is the perfect one.

But let's start with the origin: I really need negative scorings on the futures. I previously thought it was an abomination, and in a philosophical point of view still is, but it is mandatory if you want to have an real AI, one that can compite to acomplish a goal, to beat an oponent or to get as many score as possible: to have an intelligence that is usefull on optimizing, on game theory, etc.

Why it rendered mandatory to have negative scoring will be covered on a next post, now I will just introduce you the level 7, and we will start with a visual comparasion with some previous intelligence level on my old and good "test circuit".

For this occasion, I rescued from the old days 3 levels to compare with level 7:

White kart use level 3, so it score an option with N different futures as k*Log(N). It woud be the real entropy of the option if all futures were equally probable, or would dissipate the same amount of energy, but it is not the case, so you will notice white kart is a little irresponsible. In a given point, if get trapped on a hard situation in with all options have aproximately the same number of futures, not of the same length, but it doesn't matter on this level 3, so it get totally stopped. Pathetic.

Yellow kart uses venerable level 5, meaning it uses the square of the raced distance to score each of the N different futures found for an option, and the option's score is just the plain sumatory of the N futures' scores. It fits 100% on the entropy definitions, but there isn't a firm candidate to a "most intelligent decision based on its option's scorings" on the theory, so as I explained on this post about level 6 AI, there can be room for enhacing a little more the AI.

Orange kart use the ugly level 6, it is not a real entropy formulae but a strange mixture. It was able to make faster decisions on Y-shaped bifurcations at the cost of being not efficient on all other cases. I have totally abominated from this level 6 invention, but I rescued it here as level 7 tries to fix the same problems that level 6 was suppose to fix: slow reactions of the intelligence on some not-so-clear situations. It doesn't match level 5 as you can see, so not much of a problem to discard it on all future tests.

Red kart finally sports the new level 7 intelligence. This level 7 intelligence, compared to level 5, just change one little important thing: once you have all the options of one free param scored, and before normalizing them, just get the minimum scoring and take it from all options' scores, then you normalize. It means an option could score negative, as this negative will be taken from all options, making this one to score zero. Internally I call it "ZeroedScores" as it makes sure the lowest options score will be allways be zero, while the sum of them remains being 1 as in the level 5.

They four run without colliding with the others, so you can compare each one's behaviour, but after the little white kart get stuck on a difficult part, I decidied to switch collisions on to see how the other 3 karts managed to  go throuh, and I have to say red one did impressed me: it decides to crash with the stopped kart to make him room! The yellow and orange ones are unable to decide anything and stop along with the white one. No doubt after this red one is really better!

Level 7 really works nicer than any other, and even if it was specifically crafted to be usefull with negative future scores, it makes it way better than level 5 on this case with all futures being scored positive. The side effect of lowering the lowest scores down to zero is that, the rest of the scores grow proportionally once they are normalized, so you get a quickier intelligence that doesn't let hard decisions for the last moment, but this time without breaking any entropy law!

So in all next videos, the default AI level will be 7, and if this time I am right, no more levels will be neccesary... but it doesn't mean we can get way more of the AI... we have goals to play with!