sábado, 25 de janeiro de 2014

Heuristics

Dear Friends,

Our project has finally come to an end. Last Friday we delivered our Defender bot to our professor. Let's hope he liked it. Even tough we haven been posting this late week we have been working hard. With the end of the Semester it has been non-stop.

So, after being able to create the tree. we began to play the game to understand which would be our best heuristic. Soon enough all of us agreed that we should maximize both life and energy. But that's not something easy to "teach" a robot. Later on, we figured out that the energy is more important in the beginning and the lack of life was more concerning in the last rounds. Thus we divided the game in three big sectors. The first when there were 4 or less enemies shown, the second when there were five enemies as lastly when all the six enemies appeared.

When there are less than four enemies we don't want to lose more than 200 energy points. So, at the end of the round we want to have 300 or more energy points. Since we are regaining 50% of the energy left in the next round the bot will have a minimum of 450 energy points. If there are 4 enemies already out the robot will be able to use 250 energy points. Then, after finding all the possibilities that waste less than the maximum energy defined for that amount of enemies the robot will choose the one that keeps the most of life. If there are two possibilities that leaves the bot with the same HP(hit-points) the robot will choose the one that uses less energy. If the amount of life and energy are the same between two possibilities it will choose the one that kills more enemies.

If five enemies have already shown up in different round the bot will play the same way as if there were four or less enemies. The difference will be the amount of energy that can be used. If we are early in the game the bot will use only 250 energy points. If the game has reached the 6th round (3 rounds for the bot, 3 for the enemies) it will use the maximum of 300 energy points. Choosing the which branch of the tree to use is the same way as if there were 4 or less enemies. Another big difference is if by any chance the robot is able to kill all the enemies remaining and keep more than 500 life point it will choose to kill all the enemies even if it wastes all the energy that is left. Why? Because one enemy can take the maximum of 500 life points, since there will be only one enemy left the robot will make that choice guaranteeing its win. If the five enemies appear all at once and the no way of killing all of then and keep more than 500 HP, the robot will use the sound attack on all the five enemies. The sound attack has proven the be the most efficient attack when there are too many enemies since it takes little energy to use it.

If the last enemy is out, meaning all the 6 enemies have shown, the defender bot will try to kill all the enemies. If there is not possible to kill all the enemies it will chose the one that takes the most of the enemies out without losing all its energy. If by any change all the six enemies show in one round the bot will use only the sound attack. For the same reason we explained before.

It took us quite a while to figure out all of this but with the simulator built by our college Frederico we were able to test all the possibilities a lot faster and efficiently. Thanks Frederico!

Sem comentários:

Enviar um comentário