I choose to study the movements, targeting and firing techniques of other sample robots in order to gain some insight in my quest to build a competitive robot for the upcoming competition. Here is my review of 8 simple sample bots.
Walls: This is a surprisingly effective bot with a simple idea. Walls finds the distance to the nearest wall and turns to face it. It then moves toward the wall and when it gets there, it starts moving along the walls shooting at any enemy with medium fire power that it scans with its radar. This bot is hard to hit and its bullets come at weird angles because of its movement.
RamFire: This bot charges at the enemy and fires when the enemy is in its target path. It is only effective against bots like the Sitting Duck. Bots, like Walls, avoid RamFire's actions entirely. A good tactic about this bot is that it fires proportionally to the amount of energy left on the enemy. So if the enemy has high health RamFire will fire at its maximum potential and ram the target for extra bonus points instead of shooting it.
SpinBot: Spinbot is quite ineffective as it spins in circles shooting wildly at its target. If it scans another bot, it will fire at its maximum power. However, this doesn't work too well since the bot is spinning. An interesting fact about this not so interesting bot is that if it hits another bot it checks to see if it "isMyFault". This means that if the SpinBot hits the enemy, the bot will turn to the right 10 pixels instead of firing.
Crazy: This bots movements will make you sick if you watch it too long. However, you can't ignore the fact that Crazy's defensive strategy is pretty darn effective. A new technique I saw in this code is the setTurnRight and waitFor methods. What's interesting about this, is that you can 'set' the next action based on another action. For example if setTurnLeft is called, it will waitFor a TurnCompleteCondition on its self (this). I found this a great tactic, and I may use it for my competition robot. Crazy also features a reverseDirection method when it hits a wall that calculates where it is and reverses direction based on boolean values. It also has other common characteristics like isMyFault and firing upon a scanned event.
Fire: Fire is a basic bot where it turns its gun in a circle until an event is triggered. When onScannedRobot is called, it will shoot at its full power if the other bot is close and it has a lot of energy left. This is a smart move in order to conserve strength. It also has a defensive mechanism that takes place after the fact it has been hit by a bullet. It will move in a horizontal direction away from the bullet that hit it. If another bot rams into it, it will turn its gun toward the bot and fire full strength.
Sitting Duck: An interesting bot that does more then you might think. Along with sitting still and doing absolutely nothing, this bot keeps a score in a file that allows its stats to be read long after the bot has died. It opens a file, "count.dat" and increments the number of rounds and battles it has fought.
Corners: This bot goes North. When it reaches the wall it goes all the way to the left corner. It then faces the playing field and shoots at the enemy when it scans it. It fires at the enemy depending on its distance. If the enemy is far away it shoots weakly, if it's close then it fires hard. An interesting thing about it is that it uses the stop method to stop what it is doing and then fires continuously at the enemy. This is quite effective because it has visible range over the whole playing field and can easily overwhelm the enemy with firepower. Corners also checks the amount of other robots left and will switch corners for the next round.
Tracker: This bot is pretty impressive in logic, but is not so effective against enemies. It will look for an enemy and if it doesn't find it, Tracker will turn its gun, effectively moving its radar. If Tracker can't find the enemy, it will stop tracking that enemy. If it finds another enemy while it has an enemy, it will ignore it using its trackName String and turn and move towards it if it is too far to have an effective shot, otherwise it will shoot at its full power. Tracker also incorporates defensive movement as to not get rammed or fired upon at too close of a distance by the enemy. What I really found entertaining was that if another enemy rams into it, as we would find in the behavior of RamFire, it then sets it's target to that bot as sort of a retaliation.
Code review has been an excellent process to learn new techniques and thinking patterns of other coders. It helped me start thinking about new strategies for my competitive robot. I can't wait to start looking at the more advanced robots.