To better understand the samples provided with the Robocode package, I will be analyzing 8 sample robots in the areas of movement, tracking and firing.
Walls:
Movement: Regardless of starting position this robot will always face the the nearest wall with the least angle movement to face the wall. The robot will then head to that wall and move to the closest corner. From there the robot will move clockwise around the walls of the arena. If this robot hits another it will reverse, do a left turn then head to the nearest wall, move to the corner and continue moving along the walls.
Targeting: There is no targeting algorithm for this robot. Simply if a robot is scanned this robot will open fire on it.
Firing: The only criteria for firing is when a robot is scanned.
RamFire:
Movement: Movement is determined by the enemy robot's position. Once an enemy is scanned the RamFire will then move up to it and ram into it. In the case that the robot has moved, RamFire will follow it.
Targeting: The tank moves until it scans a robot then the gun is pointed at the enemy.
Firing: Firing is initiated once the RamFire has rammed into the robot it is targeting. Firing continues until the enemy moves.
SpinBot:
Movement: SpinBot moves in circles continuously in one spot.
Targeting: There is no targeting algorithm besides scanning.
Firing: SpinBot fires when a enemy robot is scanned.
Crazy:
Movement: This robot will move forward and turn right, but keep moving while making the right turn, then it will turn 180 degrees to the left while still moving, after that the robot makes a 180 degree right turn while moving. This process is repeated forever. When it hits a wall the direction is reversed.
Targeting: There is no targeting algorithm besides scanning.
Firing: Crazy fires when an enemy robot is scanned.
Fire:
Movement: This robot only moves when it is hit in which case it makes a right turn and moves 50 pixels the first time. With each hit the amount moved decreases by 1 pixel.
Targeting: There is no targeting algorithm besides scanning.
Firing: If Fire has more than 50 energy and the enemy is less than 50 pixels away, the robot will fire at power 3, else it only fires at power 1.
Sitting Duck:
Movement: This robot doesn't move.
Targeting: This robot doesn't target other robots.
Firing: This robot doesn't fire on enemy robots.
Corners:
Movement: Regardless of the robots position, it will turn to face the north wall, go to the wall and make a left turn and move all the way to the top left corner.
Targeting: There is no targeting algorithm besides scanning.
Firing: Corners fires proportional to the distance of the enemy or current energy level. In the first case if the enemy's distance is less than 200 or the energy level is greater than 15, the robot will fire at power one. If the enemy robot's distance is less than 50 Corners will fire at power 2. Otherwise the robot will fire at power 3.
Tracker:
Movement: Tracker's movement rate is determined by the enemy that it is tracking. Once Tracker finds an enemy, it will move to 140 pixels of its position and either wait or fire on the enemy robot. Also if the enemy is too close (within 100 pixels) Tracker will move back in the enemy has a position of less than -90 degrees and equal or less than 90 degrees. Else it moves ahead 40 pixels.
Targeting: Once the enemy is scanned the gun will move to face the enemy. It will re-rotate every time Tracker is tracking an enemy.
Firing: The gun will always fire at the power of 3.
Conclusion:
I think that a lot of basic structures for movement and tracking can be learned from these sample robots. I know while designing my robots I would often look to these sample robots to gain inspiration or to review and adapt algorithms that were used.
Wednesday, September 16, 2009
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment