In the world of rumbles and tournaments, in order to win, you must train. As part of training for a Robocode tournaments, one must assure that his or her code is error free. To do this, I called upon the help of specialized trainers.
What each trainers do: (according to their respective websites)
Ant: It is a Java-based build tool
that evaluates a set of dependencies, then execute commands.
Checkstyle: It provides checks that find class design problems, duplicate code, or bug patterns like double checked locking.
PMD: It scans the Java source code and looks for potential problems like:
•Possible bugs - empty try/catch/finally/switch statements
•Dead code - unused local variables, parameters and private methods
•Suboptimal code - wasteful String/StringBuffer usage
•Overcomplicated expressions - unnecessary if statements, for loops that could be while loops
•Duplicate code - copied/pasted code means copied/pasted bugs
FindBugs: It looks for bugs in the Java programs. It can find bugs by simply inspecting a program's code: executing the program is not necessary.
During the training sessions, MikeTerry was able to work on shortening his comments, labeling his parameters properly, and putting in the author tag. With these trainers MikeTerry's muscles (code) became more effective. The encounters between MikeyTerry and his trainers were unexpected. I had expected a few querrels and stubborness on either party but they worked pretty good with eachother. No particular problems. As the main trainer for MikeTerry, I have learned from his other trainers that my standarization coding must improve and how many ways I can improve other programs training. I really like these trainers as they simplify the training and elimate most of the tedious tasks that I have to encounter during a training.
After the training with the other trainers, MikeTerry and I worked on his level of energy for the next tournament. He was already well trained but with the increase of energy, he will be able to last longer in battles.
Here's a look at the before (this is a .jar file) and after (this is a .zip file) of MikeTerry's code.
Wednesday, September 30, 2009
Monday, September 21, 2009
In the blue corner, we have the contender MikeTerry v1.0...
In my previous posting, I reviewed the sample robots that we were assigned. And on Monday, we have a tournament with the advance robots that we wrote. As I prepare myself for the first RoboRumble, I am excited to see the competition.
MikeTerry v1.0 (Here is MikeTerry's code)
My robot’s name is MikeTerry, he is base on the sample robot Walls. The difference in my robot is that his fire power is based on enemy distance and if he is loosing, his fire power will be at 3.
I kept it relatively simple.
Practice Rounds
MikeTerry vs. Corners - Winner MikeTerry
MikeTerry vs. Crazy - Winner MikeTerry
MikeTerry vs. Fire - Winner MikeTerry
MikeTerry vs. SittingDuck - Winner MikeTerry
MikeTerry vs. RamFire - Winner MikeTerry
MikeTerry vs. SpinBot - Winner MikeTerry
MikeTerry vs. Tracker - Winner MikeTerry
MikeTerry vs. Wall - Winner MikeTerry (depending on starting points)
Training for next tournament
During the time following this tournament, I will train MikeTerry's strategy to beat the sample robot Wall.
Word of wisdom
It is hard to find one strategy to beat all the sample bots, it is easier to focus on beating as many as you can versus all of them.
MikeTerry v1.0 (Here is MikeTerry's code)
My robot’s name is MikeTerry, he is base on the sample robot Walls. The difference in my robot is that his fire power is based on enemy distance and if he is loosing, his fire power will be at 3.
I kept it relatively simple.
Practice Rounds
MikeTerry vs. Corners - Winner MikeTerry
MikeTerry vs. Crazy - Winner MikeTerry
MikeTerry vs. Fire - Winner MikeTerry
MikeTerry vs. SittingDuck - Winner MikeTerry
MikeTerry vs. RamFire - Winner MikeTerry
MikeTerry vs. SpinBot - Winner MikeTerry
MikeTerry vs. Tracker - Winner MikeTerry
MikeTerry vs. Wall - Winner MikeTerry (depending on starting points)
Training for next tournament
During the time following this tournament, I will train MikeTerry's strategy to beat the sample robot Wall.
Word of wisdom
It is hard to find one strategy to beat all the sample bots, it is easier to focus on beating as many as you can versus all of them.
Wednesday, September 16, 2009
The mole: Analyzing enemy’s strategies from the inside.

Enemy Name: Walls
Movement: He will move away from the enemy whenever he is hit, he will travel along the wall.
Targeting: He rotates around the board while shooting at the enemy scanned.
Firing: He always fires at the same strength.
Enemy Name: RamFire
Movement: He tracks the enemy and attempts to ram him.
Targeting: He looks to gain bonus points by keeping enemy scanned alive to ram
Firing: He fires according to how much energy the enemy scanned has remaining.
Enemy Name: SpinBot
Movement: He spins around in a circle while shooting at the enemy scanned.
Targeting: He turns in a circle while scanning for an enemy.
Firing: He shoots on a constant strength depending if the enemy’s spotted bearing meets the criteria of being greater then -10, away and less than 10.
Enemy Name: Crazy
Movement: He moves in odd movements attempting to throw off robots without good tracking systems. If it hits wall, it reverses direction and it always does this if it hits a robot and its caused the collision.
Targeting: He looks for any enemy.
Firing: He always fires at a set strength once enemy is found.
Enemy Name: Fire
Movement: Only moves when he is hit.
Targeting: He spins his gun while scanning for an enemy.
Firing: He fires depending on the enemy’s health.
Enemy Name: Sitting Duck
Movement: He doesn’t move
Targeting: He doesn’t target
Firing: He doesn’t fire.
*He is definitely not an enemy that I will take any strategy from*
Enemy Name: Corners
Movement: He will retrieve to the corner while scanning for an enemy.
Targeting: He targets the first enemy he scans.
Firing: The close he is to the enemy, the more powerful bullets he will use.
Enemy Name: Tracker
Movement: He will not move until an enemy is targeted, he will follow and maintain a distance from the enemy.
Targeting: He concentrates on one enemy until it dies.
Firing: He will fire at the same strength.
With the opportunities of being on the inside, I was able to take some of the strategies in consideration for my warrior robot. Now I have to go prepare for battle. At war we shall meet again.
(image source: http://davidalves.net/images/robocode/robocodeII_logo_idea.gif)
Monday, September 14, 2009
Plastic Surgery for Robots
While observing Paul Galiza’s Code, I realized how important standardization was in the world of programming. As I look carefully at his code, I was amazed by the differences that people can have for coding the exact same function for the same project. Having a standardized coding helps future users and the author to decipher what is actually happening in the code.
After reading The Elements of Java Style, I started editing my robots’ code (from last week’s project) to meet the standards. I felt that I was a plastic surgeon giving my robots makeovers. I got so into editing my codes that I wanted to give a makeover to all of my previous projects to meet that same standard but I decided not too as I will probably start dreaming about coding and won’t be able to make the difference between English and Java after awhile.
Here is a link of my newly improved robots.
After reading The Elements of Java Style, I started editing my robots’ code (from last week’s project) to meet the standards. I felt that I was a plastic surgeon giving my robots makeovers. I got so into editing my codes that I wanted to give a makeover to all of my previous projects to meet that same standard but I decided not too as I will probably start dreaming about coding and won’t be able to make the difference between English and Java after awhile.
Here is a link of my newly improved robots.
Subscribe to:
Posts (Atom)