Sunday, September 20, 2009

Building your own robot.

Robocode is a open source software available on sourceforget.net. This is my attempt creating a robot implementation using their package. I'm at a point now where I have a basic understanding of the structure and techniques for controlling a robot. My past blogs have detailed my studies into other sample robots provided by the Robocode program. Now I'll give a brief overview of how my robot works in the same format. I have christened my robot Bato.

Movement:
The robot moves in a circle in order to dodge bullets fired at it. During every iteration, it moves 36 degrees to the left and ahead 20 pixels. I chose 36 pixels because I did not want the robot to move in a perpendicular way. If it moved at 36 degrees or some degree which did not add up to 360 every time, there would be a certain randomness to it. It has proven effective against robots like Corners, Fire, RamFire, Crazy and of course SittingDuck. I did have difficulty with Wall, SpinBot, and Tracker however.

Targeting:
The targeting for Bato lies in using something similar to Tracker. Bato keeps its sights on one target and attempts to maintain the focus in order to fire continuously at this target. While this was effective against the aforementioned robots, Wall, SpinBot and Tracker were not so easy to beat. With Corners, Fire, RamFire, Crazy and SittingDuck, I had a nearly 100% winning streak. But with the other three robots, the statistics were lower. It appears that Bato's movements are so similar to SpinBot that it does not have an advantage with it. It was the same with Tracker, the targeting strategy of Bato was so similar to Tracker that the results were almost always 50:50. And the Wall robot remains dominant.

Fire:
My strategy for this was simple. I had observed that most of these robots only fired at certain times. Therefore, I chose to fire as frequently and use the most power fire I could. The only drawback was that Bato is frequently disabled if it cannot hit the target if it is moving too fast.

I've learned a little bit about project development through this robot building process. When the time came for coding, it was pretty simple. The problem was to find an idea that worked. This is a classic problem for developers. When I had this problem, I knew I was on a good path because I did not have many problems with syntax or knowing how to do something. That part of development should have been handled by now, and sure enough I had more problems with working at the performance side of the program.

When I look at my robot now, I definitely see flaws in it's strategy. I think if I had a lot more to development this robot I would add in a lot more small details to tweak it and give it more functionality. The project was very helpful in learning how to develop a competitive piece of code.
Here is the robot package. It is entitled "Competitive robot: Bato 1.0."
(http://www2.hawaii.edu/~wingma/)

No comments:

Post a Comment