sábado, 25 de janeiro de 2014

The end

Hey!

It was really fun to build this robot we had some priceless moments while studying the game and building everything. Soon enough we will have a video with some of that fun (:D)! But not everything was good. We had some problems trying to create the tree, it took us two days to start to code it. We couldn't figure out where to start (>_<). Shame on us!

I leave here the link to our code whether you want to take a peak our try it.
Defender Bot code

Check some photos of the first and second deliver.
Defender Bot Photo


Goodbye dear followers! :D

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!

quarta-feira, 8 de janeiro de 2014

Testing

Hi there,

While trying to make the bot intelligent we have been filming some of the games. Some we won, other we let them win (hahaha).


segunda-feira, 6 de janeiro de 2014

How to Think?

Dear Friends,

Our first post of 2014 (:-D). I hope all of you have a great year.

After changing the world and the robot. Since we got an extra RGB sensor that we are using to to detect the yellow and green stripes, which are the limits of each slot, instead of the light sensor. I cannot even begin to describe how easier it is with the RGB sensor.

The next question and our main problem was how to make it [the robot] think. After some research throughout the class papers and some discussion we figured out that the best way to make the robot intelligent was to create a little tree and look for the best attack sequence. 

This was our first draft of the tree and its nodes.


While trying to make the tree we missed the good old c++ pointers and structs..Since there is no pointer in Java we got a bit confused when trying to point to other nodes. 

In each node we save the energy spent, the hp the bot still has, the parent node, the sub-nodes, the total number of attacks of all the enemies, the number of enemys killed, and how many enemies it needs to attack.

The sub-nodes are the result of each attack the robot can use on the enemy. Therefore the number of sub-nodes will change accordingly to the type. 3 sub-nodes (do nothing and 2 attacks) if the enemy is an Infantry. 4 sub-nodes (do nothing and 3 attacks) if the enemy is a Tank.

To begin with, our strategy will be to kill every Artillery that shows up so, in order to reduce the tree, the Artillery will not take part in the tree. The robot has a small "brain" so we are trying not to overdo it.



domingo, 29 de dezembro de 2013

The new world

Dear Friends,

It has been a while since our last update though we have been working non-stop ever since. We were able to deliver the dumb robot on the 26th of December. Although it's almost smarter than us. The professor presented us with a pretty 14,5 out of 20. Yay!!

Right now we are working on the next stage, a smart robot. We did some big changes in our "world", we bought some nice blue paper and covered our board with it. Instead of that awful black tape we were using we also bought Yellow paper to set the slots. It´s looking really nice, I guess...

We made a video to share our work and our weekend. This might be the best Christmas present this year :D

See you soon!


quarta-feira, 20 de novembro de 2013

How to find enemies

After we built the rotating base we moved on to the mechanism that will support the RGB sensor to search for the enemies. We chose the RGB sensor because, as we were told, it is the most reliable sensor. Therefore our first attempt to find the enemies will be with it. We could use the touch sensor, but there are three different types enemies and it would make it hard to know which one it would be touching. We decided to do a stretchable structure so it does not occupy too much space and makes it easier to handle.



This is our first try and it looks like it can handle the job! We will do further tests so we are able to figure out whether the RGB sensor is the most suited.

Rebuilding

Hello once again,

It´s been a while since the last time, but we bring some good news! It has been going really well (for now).


Last post we had decided to dismantle our little friend. So we did, twice. It looks like it is strong enough to handle all the weight of the robot and the sensors. Since the cables were too small for our first solution we decided to move everything instead of just moving the crane. The cables will not be a problem anymore!

 This was our first attempt. We thought it would be better that the sector which rotates touched the floor, because it will give some support to the rotation base and support all the weight. In this one we put the rotating motor in the middle but was getting a bit loose. The connection between the base and the rotating base was not strong enough.


 So we dismantled it once again to build our latest version. It still touches the floor for the stability. But we changed the motor to the wheel. The wheel rotates better and stronger. It made it, also, possible to build a more sustainable connection with the base. With all the robot up on the rotation base we do not need to worry about the cables (for now).


Let's see where this solution takes us and hope this is the one! With the motor at the wheel the rotation base gains too much power for its current base. So we have to find a way to fix the base to the ground.