There are many tools in the programming world that help make things easier to do. Let me introduce you to this awesomely nifty thing by taking it's acronym: ANT. What is ANT? Well for starters it doesn't mean awesomely nifty thing like the title states it to be nor it is those tiny black creatures you find on your picnic. What is it then? ANT actually stands for Another Neat Tool… Yeah, my title might seem similar to its actual name, but hey, Ant is both awesomely nifty and neat.
Developed by the Apache Software Foundation, Ant is a tool for automating software build processes. I'm not going into much detail what a build system does, but basically it is scripting that can compile, package, test, create documentation and deploy code.
Ant is like a programming language that uses XML which I don't have much experience with, so to test out the functionalities of Ant… Yes, you guessed it, Code Katas. The total of eight Ant Code Katas creates the HelloAnt Program. Overall, these katas did show me the basics of Ant. The first three katas introduced printing to the console, the immutable properties of ant and dependencies which are conditions. The rest of the katas mixed in a bit of java with the scripting. With the help of the Ant API, it was fairly simple to compile, create javadoc and package the entire directory. These scripts are just simple shortcuts that otherwise someone would type manually in the console and they save time.
Elmar Carillo --- Software Engineering Blog & Other Thoughts --- University of Hawaii at Manoa --- ICS 314
Tuesday, September 27, 2011
Monday, September 19, 2011
Kode Cut a Row Bow Code
Who is Kode? Why did he cut a "row bow code"? What is this about? Say it slow: Kode-cut-a-row-bow-code. Now say it fast: Kodecutarobocode. Keep saying this phrase with practice and repetition then you'll get Code Kata: Robocode.
For those who may know what this is about, did you see the analogy there? Well, basically what we did in this introduction exercise was to practice and repeat doing a task. In programming, a Code Kata is referred to an exercise which helps a programmer build their skills through practice and repetition. This is the first part of the topic. So this leaves Robocode as the second part.
In short words, Robocode is "Robot Code". Robots programmed in Java compete with others through movement, radar and attack. There are many ways to design a robot, but how do you design the "best" robot? Well, first you need to… STOP! Before building the "best" robot, we need to start off small and deal with the basics first: code kata.
The following list are simple robot exercises created to test out the basic robot functionalities:
Now let's create them robots! Ready, set, GO!

Okay, thanks for waiting while I was creating these robots. Some were easy to implement, while others took a lot more thinking to get it to run properly. Let me go over the robots I created in the three groups:
Position
This first group of robots practices with moving the robot. Position 01, 02 and 03 were straightforward using turns and moving the robot ahead. Then I got to writing out position 04. This robot could be implemented in… I would say 2 ways. The first is the simple method of moving the robot to the same X or Y coordinate as the center point then traversing the remaining axis to the center. I created this robot first but wanted to be adventurous and try the second method which involves a little trigonometry. a2 + b2 = c2? Right. This method calculates the distance to the center, rotates the robot to face the center, then moves it to the center. I drew it all on paper before attempting this method and it went well. The robots correctly moved to the center in every test. Here are some of the drawings I did for this algorithm:
Now to position 05. This method builds off of position 04 to move to the corners instead of the center. Finally, position 06 is basically position 04 plus a circle. To create the circle, I figured that since the robot will need to travel the circumference and there are 360 degrees in a circle, the robot will need to travel (circumference / 360) and turn 1 degree at every turn. The outcome was that the robot did move in a circle with the given radius, but it was very slow because the robot moved forward and it turned after moving instead of doing these two methods simultaneously.
Follow
These robots introduced the radar functions of the robot. All three were very similar in design which involves using the radar and moving when an enemy is detected. For the first two follow 01 and 02, we needed to only had to follow one enemy, and to do that you just scan the robot and get its name. If the name of the enemy scanned is the same as the previous enemy, then move, otherwise continue scanning.
Boom
The final set of robots brings in the gun of the robot. The first two robots Boom 01 and 02 were the same and differed by one thing. Boom 02 only fired at the same enemy. With these two robots, you simply rotate the guns and when the radar detects an enemy, you fire the robot's gun. Boom 03 builds off Boom 01. Instead of firing the guns at the same power, we get the distance of the enemy and fire the guns at a power according to the distance the enemy is away. Finally Boom 04. This is the only robot in this group that doesn't actually boom (Fire its gun). The algorithm here is to track the same enemy as in Boom 02, but rotate the robot's gun to always point at the enemy.
Overall by completing these code katas, I learned more about the robocode class. I guess if you practice robocode by doing these code katas you will learn more about the rodocode API, don't you agree? So how about getting to designing the "best" robot? Let's not get into too much detail, but for me, a "good" robot has a great combination of movement, radar and attack. A "good" robot should know when to move and when to stay in position. It should also have a good defense system that detects all obstacles and treats and decide how to overcome them. Lastly, the robot should also have good offense. It should know when to attack and decide if it will hit an enemy instead of missing all the time. That's what I think the "best" robot is, however, there is an advanceRobot class in the robocode API. This allows for more advanced control over the robot, but for this topic, let's just stick to the basics and create something advance with the tools we have.
Generally these code katas make you think in different ways to solve a problem. Sometimes you can approach a problem in a simple matter whereas others can be more complex, just like how I approached the position 04 robot. There are many ways to do one thing and there is no wrong way to do it if it works correctly. It like every day life. Practice makes perfect… Well nothing is perfect, so let's rephrase, practice makes better! So what do you think of robocode now? Cool or cool??? Try it out, take on these code katas, practice, and you could possibly design the best and destroy the rest! Good luck to you!
Links:
Robocode Home: http://robocode.sourceforge.net/
Robocode API: http://robocode.sourceforge.net/docs/robocode/
RoboWiki: http://robowiki.net/wiki/Main_Page
For those who may know what this is about, did you see the analogy there? Well, basically what we did in this introduction exercise was to practice and repeat doing a task. In programming, a Code Kata is referred to an exercise which helps a programmer build their skills through practice and repetition. This is the first part of the topic. So this leaves Robocode as the second part.
In short words, Robocode is "Robot Code". Robots programmed in Java compete with others through movement, radar and attack. There are many ways to design a robot, but how do you design the "best" robot? Well, first you need to… STOP! Before building the "best" robot, we need to start off small and deal with the basics first: code kata.
The following list are simple robot exercises created to test out the basic robot functionalities:
- Position01: The minimal robot. Does absolutely nothing at all.
- Position02: Move forward a total of 100 pixels per turn. When you hit a wall, reverse direction.
- Position03: Each turn, move forward a total of N pixels per turn, then turn right. N is initialized to 15, and increases by 15 per turn.
- Position04: Move to the center of the playing field, spin around in a circle, and stop.
- Position05: Move to the upper right corner. Then move to the lower left corner. Then move to the upper left corner. Then move to the lower right corner.
- Position06: Move to the center, then move in a circle with a radius of approximately 100 pixels, ending up where you started.
- Follow01: Pick one enemy and follow them.
- Follow02: Pick one enemy and follow them, but stop if your robot gets within 50 pixels of them.
- Follow03: Each turn, Find the closest enemy, and move in the opposite direction by 100 pixels, then stop.
- Boom01: Sit still. Rotate gun. When it is pointing at an enemy, fire.
- Boom02: Sit still. Pick one enemy. Only fire your gun when it is pointing at the chosen enemy.
- Boom03: Sit still. Rotate gun. When it is pointing at an enemy, use bullet power proportional to the distance of the enemy from you. The farther away the enemy, the less power your bullet should use (since far targets increase the odds that the bullet will miss).
- Boom04: Sit still. Pick one enemy and attempt to track it with your gun. In other words, try to have your gun always pointing at that enemy. Don't fire (you don't want to kill it).
Now let's create them robots! Ready, set, GO!

Okay, thanks for waiting while I was creating these robots. Some were easy to implement, while others took a lot more thinking to get it to run properly. Let me go over the robots I created in the three groups:
Position
This first group of robots practices with moving the robot. Position 01, 02 and 03 were straightforward using turns and moving the robot ahead. Then I got to writing out position 04. This robot could be implemented in… I would say 2 ways. The first is the simple method of moving the robot to the same X or Y coordinate as the center point then traversing the remaining axis to the center. I created this robot first but wanted to be adventurous and try the second method which involves a little trigonometry. a2 + b2 = c2? Right. This method calculates the distance to the center, rotates the robot to face the center, then moves it to the center. I drew it all on paper before attempting this method and it went well. The robots correctly moved to the center in every test. Here are some of the drawings I did for this algorithm:
Now to position 05. This method builds off of position 04 to move to the corners instead of the center. Finally, position 06 is basically position 04 plus a circle. To create the circle, I figured that since the robot will need to travel the circumference and there are 360 degrees in a circle, the robot will need to travel (circumference / 360) and turn 1 degree at every turn. The outcome was that the robot did move in a circle with the given radius, but it was very slow because the robot moved forward and it turned after moving instead of doing these two methods simultaneously.
Follow
These robots introduced the radar functions of the robot. All three were very similar in design which involves using the radar and moving when an enemy is detected. For the first two follow 01 and 02, we needed to only had to follow one enemy, and to do that you just scan the robot and get its name. If the name of the enemy scanned is the same as the previous enemy, then move, otherwise continue scanning.
Boom
The final set of robots brings in the gun of the robot. The first two robots Boom 01 and 02 were the same and differed by one thing. Boom 02 only fired at the same enemy. With these two robots, you simply rotate the guns and when the radar detects an enemy, you fire the robot's gun. Boom 03 builds off Boom 01. Instead of firing the guns at the same power, we get the distance of the enemy and fire the guns at a power according to the distance the enemy is away. Finally Boom 04. This is the only robot in this group that doesn't actually boom (Fire its gun). The algorithm here is to track the same enemy as in Boom 02, but rotate the robot's gun to always point at the enemy.
Overall by completing these code katas, I learned more about the robocode class. I guess if you practice robocode by doing these code katas you will learn more about the rodocode API, don't you agree? So how about getting to designing the "best" robot? Let's not get into too much detail, but for me, a "good" robot has a great combination of movement, radar and attack. A "good" robot should know when to move and when to stay in position. It should also have a good defense system that detects all obstacles and treats and decide how to overcome them. Lastly, the robot should also have good offense. It should know when to attack and decide if it will hit an enemy instead of missing all the time. That's what I think the "best" robot is, however, there is an advanceRobot class in the robocode API. This allows for more advanced control over the robot, but for this topic, let's just stick to the basics and create something advance with the tools we have.
Generally these code katas make you think in different ways to solve a problem. Sometimes you can approach a problem in a simple matter whereas others can be more complex, just like how I approached the position 04 robot. There are many ways to do one thing and there is no wrong way to do it if it works correctly. It like every day life. Practice makes perfect… Well nothing is perfect, so let's rephrase, practice makes better! So what do you think of robocode now? Cool or cool??? Try it out, take on these code katas, practice, and you could possibly design the best and destroy the rest! Good luck to you!
Links:
Robocode Home: http://robocode.sourceforge.net/
Robocode API: http://robocode.sourceforge.net/docs/robocode/
RoboWiki: http://robowiki.net/wiki/Main_Page
Tuesday, August 30, 2011
Pop the FizzBuzz in Eclipse

(types on the keyboard).
Time's up! Five minutes and 53 seconds. Wow. So does it work? Well, from a view point, the output looks correct. The overall code is similar to that we went over in class. There are two methods in my program rather than one. The first methods takes in a number and returns an output depending on the number such as numbers being a multiple of 5 returns "Buzz". The second method is the main method that is the basic loop of the program from 1 to 100. This method calls the first method and prints out the output.
Overall, I am satisfied with the code I wrote. I could have made a one method program that would have been faster to write, but having this second method could ensure correct output with a test program. Coding the program went smoothly and I did not run into problems with eclipse. I do notice that I take my time to choose variable names and try to make them specific, rather than one character names. The only thing I think I could improve on is to rely less on eclipse. Having used ellipse for several semesters, there are many shortcuts to do a task. Maybe that's why I took a while to write this code on paper. I've become too dependent on eclipse over the years.
Monday, August 29, 2011
Being More Social Online

My professional portfolio is now up. you can view it at (https://sites.google.com/site/elmarcarillo/). It contains information about myself and will be updated with the projects that I will be working on. Also signed up TechHui which is an online community for science, technology and new media in Hawai'i. My home can be accessed at (http://www.techhui.com/profile/ElmarCarillo). I will be using these two sites including this blog for this ICS 314 class.
Friday, August 26, 2011
Three Important Pixels

Graphics editing today seem to be dominated by Adobe Photoshop. Don't get me wrong, Photoshop is an amazing program but the one thing that defer users from getting it is it's price. Photoshop is not cheap and with every major revision, users will need to pocket out a couple hundred dollars just for some new features. Personally I have purchased and used Photoshop for many years with the thought of not looking anywhere else for a similar program, but I've always wondered if there are any free graphics editing programs with exceptional features.
Come across the open source software website of sourceforge, I find the program, "Pixelitor". Pixelitor is a simple graphics editing program. When compared to Photoshop, I would suspect some people to burst out in laughter, but hey, what do you expect from freeware, right? Pixelitor may not be Photoshop, but it does bring in some basic tools combined with some advanced features.
Using the Three Prime Directives introduced in this class (link), we'll see how Pixelator ranks out as an open source software with what it has to offer to end users.
- Prime Directive 1: The system successfully accomplishes a useful task.
Pixelitor provides users with a basic graphics editor. It features several image tools such as the included 70 image filters, and image layers. Image filters give users some fun ways to manipulate images with neat effects such as a kaleidoscope or creating a fisheye effect. Located in the menu, I was able to apply some color effects to an image. Image layers helps users break down the image into sectors that show up as layers. Just like photoshop, the layers show up as a panel on the right side and it easy to move a layer to the top or bottom of the stack with the arrow buttons. It would have been great if you could drag and drop, which is not presented in the program. Pixelitor may not contain as many features for a graphics editor, but it sure beats many simple image programs such as Microsoft Paint. Sometimes having less tools makes you think in more creative ways to compose an image.
- Prime Directive 2: An external user can successfully install and use the system.
As soon as the user is finished downloading Pixelitor, it's already ready to run. The program comes as a .jar file, so there's no installation involved (unless you don't have java on your system, which is very unlikely for this class don't you think?). I opened the .jar file and the program was up and ready. On the Pixelitor website, there are direct links to download the program and even a link that provides installation instructions. This is a simple process and I don't think anyone should have any difficulties running this program.
- Prime Directive 3: An external developer can successfully understand and enhance the system.
Written in Java, Pixelitor is a program that developers could successfully understand. However, even though the source code is neatly formatted, I could not find that many comments within the code itself. If a developer wants to enhance this program, they will need to read through the entire code to better understand it. It might sound like a fairly simple task, but when you consider that this project contains 360 .java files, this will be a lengthy task, not one that many would take unless they are really interested in this program.

Screenshot of Pixelitor
Links:
Project Home (http://pixelitor.sourceforge.net)
Downloads (http://sourceforge.net/projects/pixelitor/files)
Thursday, August 25, 2011
Evaluation of Working Environments

Wednesday, August 24, 2011
Creation of This Blog

Subscribe to:
Posts (Atom)