Anyone can write the best code that they can, but there will always be something very small that could mess up the whole program. The one nightmare for a programmer is a program that was written in one hour but still being debugged for three hours. Any programmer or ICS student knows what I am talking about. But what I have learned about Ant has helped tremendously in making sure my code is correctly made.
In a workplace, having a standard for everything can keep the workplace safe, quickly done, and easily understood by others. Formatting code helps greatly for others in the workplace to understand your code, but what about the world? What about other platforms that want to download the program that you made on your own computer? This is where the program Ant comes in. Ant is a program that contains a bunch of xml files that can check your program and the build of your program. It can check the style of your code and prompt you for every line that is incorrect. Also, it can look for bugs which check your code for incorrect inputs. The most important thing that Ant does is create a file that could be run on any pc.
When I started this program, I found that the style of my java file had a bunch of errors. What was great even though it had a lot of errors was that each error said what was wrong and where it was. It took me a while at first to figure how to correct some errors but they were easy. Most of my errors was when I was commenting about @params. But after fixing that and some whitespace my program was fine. Also what was hard was correctly assigning the titles for the xmls. I had to find each title and change it to mine.
I you would like to learn about my new Robocode file click here.
Wednesday, September 30, 2009
Monday, September 21, 2009
KillaRobot is ALIVE!!!!!!
Up until now, we have been messing around with a program called Robocode. We have been looking at how the robots work, learning how to make them move, and brainstorming strategies to defeat other robots. Coming up is a tournament that has been put together by our professor called Robowars. In Robowars we can challenge other people over the internet with the robot I created and the robot they created. But for now we are going to challenge people within our class. The robot I put together now to challenge my classmates with is called KillaRobot, KR for short.
Now that we have learned the basic movements and some strategies, it was time to design our own robots. KillaRobot does basic movements, but it destroys 7 out 8 sample robots at best 2 out of 3. The sample robots can be viewed in my last blog entry.
Creating KillaRobot
Upon building my robot, my main concern was how am I going to fire at the other robots. After doing the basic scan the battlefield and fire on scanned robot, then came the idea of just moving straight to be able to dodge enemy bullets. But after getting those two basic movements and observing that with just the basic movements I can destroy most sample robots, Ramfire comes and just destroys me. I did not know how to counter Ramfire. I tried moving away when I got hit. I tried doing circles. But it kept on winning the overall battle. Then I thought, how about I just hit Ramfire back, because I have the advantage first because I shoot it a couple times first before it hits me. Then after applying this thought, I was able to make "KillaRobot".
Movements
KillaRobot's movements are really basic. It moves in a straight line while scanning the battlefield. When it sees another robot, it fires max power. If it hits a wall, it will turn right and move forward again. What is unique about KillaRobot is that when it gets hit or hits another robot first, it will act like Ramfire. It will run into the enemy robot and fire max power. Another thing that makes KillaRobot unique is that when it gets hit by a bullet it will turn right and move forward. I made it do this when it get hits by a bullet because I noticed that it died alot when facing Spinbot. I thought how am I dying by Spinbot. I found out that since KillaRobot moves in a straight line, if it moved horizontal on the playing field Spinbot was able to hit KillaRobot. When applying the turn when KillaRobot gets hit by a bullet, KillaRobot was able to defeat Spinbot.
Victories
The robots KillaRobot was able to defeat was RamFire, SpinBot, Crazy, Fire, Sitting Duck, Corners, Tracker. Tracker wins sometimes, but overall KillaRobot wins. A win is a win. Walls is the only robot that KillaRobot cannot defeat. The next build, I will concentrate on defeating walls. Since Ramfire was what I concentrated on first, I stuck with it. And it destroyed 7 out of 8.
You can see my robot's abilies HERE.
Now that we have learned the basic movements and some strategies, it was time to design our own robots. KillaRobot does basic movements, but it destroys 7 out 8 sample robots at best 2 out of 3. The sample robots can be viewed in my last blog entry.
Creating KillaRobot
Upon building my robot, my main concern was how am I going to fire at the other robots. After doing the basic scan the battlefield and fire on scanned robot, then came the idea of just moving straight to be able to dodge enemy bullets. But after getting those two basic movements and observing that with just the basic movements I can destroy most sample robots, Ramfire comes and just destroys me. I did not know how to counter Ramfire. I tried moving away when I got hit. I tried doing circles. But it kept on winning the overall battle. Then I thought, how about I just hit Ramfire back, because I have the advantage first because I shoot it a couple times first before it hits me. Then after applying this thought, I was able to make "KillaRobot".
Movements
KillaRobot's movements are really basic. It moves in a straight line while scanning the battlefield. When it sees another robot, it fires max power. If it hits a wall, it will turn right and move forward again. What is unique about KillaRobot is that when it gets hit or hits another robot first, it will act like Ramfire. It will run into the enemy robot and fire max power. Another thing that makes KillaRobot unique is that when it gets hit by a bullet it will turn right and move forward. I made it do this when it get hits by a bullet because I noticed that it died alot when facing Spinbot. I thought how am I dying by Spinbot. I found out that since KillaRobot moves in a straight line, if it moved horizontal on the playing field Spinbot was able to hit KillaRobot. When applying the turn when KillaRobot gets hit by a bullet, KillaRobot was able to defeat Spinbot.
Victories
The robots KillaRobot was able to defeat was RamFire, SpinBot, Crazy, Fire, Sitting Duck, Corners, Tracker. Tracker wins sometimes, but overall KillaRobot wins. A win is a win. Walls is the only robot that KillaRobot cannot defeat. The next build, I will concentrate on defeating walls. Since Ramfire was what I concentrated on first, I stuck with it. And it destroyed 7 out of 8.
You can see my robot's abilies HERE.
Wednesday, September 16, 2009
RoboCode: Review of the Sample Robots
After learning the basic movements for robocode, it has become fun and interesting. Seeing the robot move, track, and fire has made this ICS class fun. But the time is getting near for RoboWars and we need strategies for making our own KRs. KILLA ROBOTS. The following 8 robots are samples that I have reviewed to make a KR.
Walls:
This robot's movement has the simplest movement. It finds the nearest wall, goes to it, and moves along the walls shooting at the enemy. It only shoots at the enemy with medium power and when the enemy is in front of the gun. The movement for this robot is not very effective. If there was an enemy in the robot's path, it treats that enemy as a wall. The enemy robot could be towards the middle of a wall and if this sample robot hits the enemy robot, it would then move along the middle of the map as if it is moving along a wall. The firing for this robot is also not that effective because if it is correctly moving along the walls it would only shoot when the enemy robot is in front of the gun. If it is not moving correctly along the walls, then it could be missing the all the robots it does not see.
Ramfire:
A robot that is like a bulldozer with a gun fixed to it. This robot will pick an enemy robot that it will fire at and run into until that enemy is dead. This would be a very effective robot if it was able to stop the paths of other robots. If it doesn't stop the paths of other robots, it is just a straight moving robot because it does not fire at the enemy until it rams the enemy robot first. Ramfire has no special movements but ramming and getting extra points and no special fire abilities because it will not shoot the enemy robot until it hits the enemy first.
Spinbot:
This robot is a very dizzying robot. It spins in a circle while wildly firing at an enemy robot at full power. Most of the time this robot misses its target. The movement of this robot has no strategy, when it has an enemy in front of its gun it fires and mostly missing. It is a little effective for dodging bullets but not very. If its target is sitting still, then this robot will win.
Crazy:
Crazy is pretty crazy... The movement of this robot is very effective for enemy robots to miss. In its code it uses setTurns, setAhead, and waitFor in the AdvancedRobot. These methods give this robot the ability to move in a curve. Unlike robot, it has to use call a lot of methods to do the same. Although it uses advanced movements, its tracking and firing abilities are terrible. The gun and radar is fixed, so when the enemy is in front of the gun, it then shoots. What is worse, it fires with the least amount of energy.
Fire:
Ouch I got hit let me move from this spot... The movements of this robot is very bad. It sits in one spot until it gets hit, then it will just move a little either left or right. The tracking is also bad because the radar and fixed gun only turns to the right scanning the field. And judging only if the enemy is close, less than 50 pixels, it will use max fire power. If the enemy is far then it will use the least fire power. What is good about this robot is if it gets hit, the gun will turn real fast pointing to the enemy robot who hit it, and fires at maximum power.
Sitting Duck:
Shoot me!!!! This robot has nothing at all. There is no movement, scanning, or firing. Basically it is a target.
Corners:
Go to the corner... This robot has a good thought strategy but is very ineffective. It is good that it goes to a corner because no one can shoot it from behind. However, if it is stopped from getting to an actual corner, this robot is useless because it thinks it is at a corner but it is not. The tracking for this robot is ok, when it reaches its corner, it sweeps its gun from 0-90 and does a little tracking when locked on to a robot. Its firepower is also ok because it fires at the enemy when it is in front of the gun. It uses low power if the enemy is far and max when the enemy is close.
Tracker:
I got you in my sights... This robot is like Tracking02, but when it gets withing a certain distance between the enemy it open fires. The movement for this robot is not effective. It just tracks an enemy and either moves toward it or away and then fires. Its targeting is good because it sweeps its radar left to right if it lost its target. If it finds it then it moves foward or backward. If it does not find it in its left to right sweep, it then spins looking for another target. Its fire power is at maximum when it gets to a certain distance between the enemy. If another enemy hits the robot, it will open fire at maximum at that robot.
Reviewing these robots have given me a little insight on what I can use as strategy for my KR.
Walls:
This robot's movement has the simplest movement. It finds the nearest wall, goes to it, and moves along the walls shooting at the enemy. It only shoots at the enemy with medium power and when the enemy is in front of the gun. The movement for this robot is not very effective. If there was an enemy in the robot's path, it treats that enemy as a wall. The enemy robot could be towards the middle of a wall and if this sample robot hits the enemy robot, it would then move along the middle of the map as if it is moving along a wall. The firing for this robot is also not that effective because if it is correctly moving along the walls it would only shoot when the enemy robot is in front of the gun. If it is not moving correctly along the walls, then it could be missing the all the robots it does not see.
Ramfire:
A robot that is like a bulldozer with a gun fixed to it. This robot will pick an enemy robot that it will fire at and run into until that enemy is dead. This would be a very effective robot if it was able to stop the paths of other robots. If it doesn't stop the paths of other robots, it is just a straight moving robot because it does not fire at the enemy until it rams the enemy robot first. Ramfire has no special movements but ramming and getting extra points and no special fire abilities because it will not shoot the enemy robot until it hits the enemy first.
Spinbot:
This robot is a very dizzying robot. It spins in a circle while wildly firing at an enemy robot at full power. Most of the time this robot misses its target. The movement of this robot has no strategy, when it has an enemy in front of its gun it fires and mostly missing. It is a little effective for dodging bullets but not very. If its target is sitting still, then this robot will win.
Crazy:
Crazy is pretty crazy... The movement of this robot is very effective for enemy robots to miss. In its code it uses setTurns, setAhead, and waitFor in the AdvancedRobot. These methods give this robot the ability to move in a curve. Unlike robot, it has to use call a lot of methods to do the same. Although it uses advanced movements, its tracking and firing abilities are terrible. The gun and radar is fixed, so when the enemy is in front of the gun, it then shoots. What is worse, it fires with the least amount of energy.
Fire:
Ouch I got hit let me move from this spot... The movements of this robot is very bad. It sits in one spot until it gets hit, then it will just move a little either left or right. The tracking is also bad because the radar and fixed gun only turns to the right scanning the field. And judging only if the enemy is close, less than 50 pixels, it will use max fire power. If the enemy is far then it will use the least fire power. What is good about this robot is if it gets hit, the gun will turn real fast pointing to the enemy robot who hit it, and fires at maximum power.
Sitting Duck:
Shoot me!!!! This robot has nothing at all. There is no movement, scanning, or firing. Basically it is a target.
Corners:
Go to the corner... This robot has a good thought strategy but is very ineffective. It is good that it goes to a corner because no one can shoot it from behind. However, if it is stopped from getting to an actual corner, this robot is useless because it thinks it is at a corner but it is not. The tracking for this robot is ok, when it reaches its corner, it sweeps its gun from 0-90 and does a little tracking when locked on to a robot. Its firepower is also ok because it fires at the enemy when it is in front of the gun. It uses low power if the enemy is far and max when the enemy is close.
Tracker:
I got you in my sights... This robot is like Tracking02, but when it gets withing a certain distance between the enemy it open fires. The movement for this robot is not effective. It just tracks an enemy and either moves toward it or away and then fires. Its targeting is good because it sweeps its radar left to right if it lost its target. If it finds it then it moves foward or backward. If it does not find it in its left to right sweep, it then spins looking for another target. Its fire power is at maximum when it gets to a certain distance between the enemy. If another enemy hits the robot, it will open fire at maximum at that robot.
Reviewing these robots have given me a little insight on what I can use as strategy for my KR.
Monday, September 14, 2009
Coding Standards - Why they are important
Coding Standards in our codes is very important in today's developing world. If there are no standards, how can anyone read your or anybody's code? If there was no MLA formmating in writing, everyones citations for their paper's would be all over the place and no one could understand where that writer got their resources. MLA formmating and Coding Standards give guidelines so anyone anywhere can read the code.
So far using using coding standards in class has not been difficult. I have been using it for my college career and it is easy to read my own code when I bring it up again to look at it. The only difference between now and when I first started my Software Engineering class, is the use of tabs. Tabs made the code look real nice and organized, however learning that tabs could be interpreted differently in a different environmet made it hard to stop using it. But since eclipse has a format option, it made it easy to eliminate those tabs.
Click here to see my new robocoding standards.
What is new in my code
While looking at my classmate's code, I noticed that on some of my codes I use the most complicated way to make it work. This reminded me from what my professor has said about his career, there is always a way that what your doing could be made simpler. While looking at my classmate BJ DelaCruz's code, I noticed that the code I wrote is a billion lines longer than what he had. So I looked at his code and made mine similar to what he had, I tried to make my code unique so it is not like I copied his code line for line, BUT his code is so simple that there is no way to not see the difference.
In everything you do, there will always be someone that could do better.
So far using using coding standards in class has not been difficult. I have been using it for my college career and it is easy to read my own code when I bring it up again to look at it. The only difference between now and when I first started my Software Engineering class, is the use of tabs. Tabs made the code look real nice and organized, however learning that tabs could be interpreted differently in a different environmet made it hard to stop using it. But since eclipse has a format option, it made it easy to eliminate those tabs.
Click here to see my new robocoding standards.
What is new in my code
While looking at my classmate's code, I noticed that on some of my codes I use the most complicated way to make it work. This reminded me from what my professor has said about his career, there is always a way that what your doing could be made simpler. While looking at my classmate BJ DelaCruz's code, I noticed that the code I wrote is a billion lines longer than what he had. So I looked at his code and made mine similar to what he had, I tried to make my code unique so it is not like I copied his code line for line, BUT his code is so simple that there is no way to not see the difference.
In everything you do, there will always be someone that could do better.
Wednesday, September 9, 2009
Robocode *****&&%%%%^^&**^%
Oh my, robots have taken over my mind... This assignment was tough on some parts and easy on others. To look at my code click here. The assignment had robots that had to do nothing and robots that had to track another robot and follow them or shoot them. IT WAS CRAZY TO FIGURE OUT ALL THE METHODS. aaaaahhhhhhh. But in the end when the robot worked, I understood very well how the robot works.
Experiences
Some robots needed a little bit of math. I have forgotten some basics of math and i needed to refresh it by looking it up in google. For example, the robot for Movement05 needed to move to one corner and move to the opposite corner. I forgot the basic a^2 + b^2 = c^2. I just needed the distance c to move across the board. lol But it was a funny refresher. Other codes needed some sitting back and thinking because they needed to do things specially. For example the tracking robots, they needed to scan the field and follow the robot it scanned.
Future build
From learning basic movements, tracking, and firing, I think that when we have to make a competitive robot, I will be able to last for a while. I would make my robot be able to recognize fired bullets and dodge them.
Experiences
Some robots needed a little bit of math. I have forgotten some basics of math and i needed to refresh it by looking it up in google. For example, the robot for Movement05 needed to move to one corner and move to the opposite corner. I forgot the basic a^2 + b^2 = c^2. I just needed the distance c to move across the board. lol But it was a funny refresher. Other codes needed some sitting back and thinking because they needed to do things specially. For example the tracking robots, they needed to scan the field and follow the robot it scanned.
Future build
From learning basic movements, tracking, and firing, I think that when we have to make a competitive robot, I will be able to last for a while. I would make my robot be able to recognize fired bullets and dodge them.
Subscribe to:
Posts (Atom)