Monday, September 21, 2009

My Competitive Robot

It is now the time to build our own Competitive Robot, that is, a Robot that can beat all of the sample Robots! Our assignment for this week was to build a Robot that can specifically beat the following sample robots: Walls, RamFire, SpinBot, Crazy, Fire, Corners, Tracker, and SittingDuck.

It certainly was not easy to build a Robot that can beat all of the eight sample robots, as they all have very different strategies. My robot, called MistaRoboto, has the following functionalities.

Movement:
The Robot first searches for nearby targets, and rotates its body so that one of its side faces directly towards the target, and moves back and forth. In other words, my Robot moves perpendicularly to its target while firing.

Targeting:
The Robot initially sweeps the battle field left and right, and once it acquires a target, it tries to keep its gun towards the target for as long as it can.

Firing:
The Robot does not fire until the target is reasonably near, that is, within 400 pixels radius. The Robot will fire with medium fire power for targets within 400 pixels and farther and 200 pixels. The Robot will fire with maximum fire power for targets within 200 pixels.

My Robot can beat RamFire, SpinBot, Crazy, Fire, Corners, Tracker, and SittingDuck pretty consistently. It has trouble with Walls however. Since my Robot is effective only against Robots within close range, it seems to have a difficult time dealing with Walls' strategy.

One mistake I made during this assignment is that I started punching out codes before really thinking deeply about my Robot's combat strategy. It seems that with projects like this, or any other projects for that matter, it is important that I map out the plan beforehand so that I understand exactly where I am headed. I also think that planning ahead actually does reduce the total time spent for coding. Therefore, I believe it is important that I build a solid plan before coding and I hope to practice this with future assignments.

You can download my Robot here

No comments:

Post a Comment