Our assignment was to complete 12 "starter" bots, see the link here for the specifics.
Overview:
Basically, all of our robots are extending the Robot class. Battles consist of a series of turns, and Robots should have a run() method which is called each turn. While running, Robots may experience various Event flags (such as being hit, shot, running into walls, running into other robots, etc). Robots may (but aren't required to) have methods that deal with these Events, and allow the robot to respond accordingly. RoboCode tactics consist of three major areas: targeting, movement, and firing. Targeting is done by whirling around a radar dish that sits atop the Robot's gun. When it finds another Robot, an Event flag is raised, and the Robot will execute the appropriate method (which usually involves firing). Movement is the final component of the Robot, and is the simplest defensive tactic the Robot can employ.
I finished all 12 bots in about a week (realistically it was two days with a long hiatus in between). Once I started planning out my competitive robot, my progress on the "starter" bots dropped all but stopped. I learned a few tricks while working on my competitive bot, and half wanted to go back and apply them to my "starter" bots. The main one was an elegant little targeting method that effectively keeps the gun fixed on a single target. (I'll post more details after the big tournament). The magic method that makes the algorithm work is normalRelativeAngleDegrees() which turns a given 360 degree angle into an angle between -180 and 180. My plan for the competitive bot is to use this tracking algorithm, along with a targeting algorithm that sets bullet power proportional to the distance of a target. This should save energy, and effectively hit any robot that:
- Tries to double back on its path
- Moves too slowly
- Ventures too close
My "starter" bots:
http://www2.hawaii.edu/~gburgess/glb.zip
No comments:
Post a Comment