Thursday, September 29, 2011

Ant

Looking up Ant tutorials, I came across this picture.  O'Reilly, being famous for having animals in their books, decided to use a lizard instead of an ant for Ant.  I guess it proves they pick animals at random and print the books.

Using Ant, I saw how easy it was to deploy development source code on different systems.  Being a build system, Ant serves this purpose very well. Since Ant is separate from any IDE, it makes open source projects at lot less painful to work with since distribution is standardized and removes human error.  It even verifies the build for you and it is a script you could switch out.  Build systems like Ant will also fill in the holes for you by downloading missing libraries.

Most of the commands available to me were simple and easy to master.  It's versatility knows no bounds, because it has a command to create zip files by itself.  It is also possible to create a new directory with the zip command by itself, where other commands would give me if I tried the same.  Ant also allows me to create my own commands which I can use to do specific actions on my build, such as creating a lighter version of my build.  The dependencies are very convenient and is more open than extend in Java since it allows multiple targets.

Although, I find the interchanging between "name" and "dir" disorienting whenever I create a target or directory.  Despite the fact that Eclipse claimed it has Ant supported, it seemed like it was never fully thought out.  It took me a while to enable Ant formatting before I decided to restart Eclipse for it to recognize it as an Ant file. 

Tuesday, September 20, 2011

Robocode

Writing robocode was not as exciting as I had hoped it would be. Rather, I found that having a strong background in trigonometry would help immensely. At the very least, was pretty neat that I could design my own robot and have them fight each other.

For some of the uninitiated, robocode was a program originally created by IBM and was later dropped by them and became an open source project. Over the years it created a fan base that programmed robots and even held competitions for it.

I was not able to complete all the assignments which was to implement simple robot behaviors. They were named according to what their behavior was supposed to be. The only ones that still remained were boom02-04 and position05. Again it was my having a weak background in trigonometry that held me back. I spent many days on position04 alone refining the trigonometric calculation so it would give me the correct direction towards the center. Even then it still took detours despite that it was heading in the wrong direction. I felt I could use what I learned from position04 for position05. I was somewhat wrong as I had to account for my robot running into the wall. When I fixed that, I realized I should have gotten a clarification on whether it should be exactly in the corner or near there. At the moment, I have it ramming the wall and reversing to turn a few degrees just like Austin Powers. Boom02-04 all depended on each other and since I could not do boom02, I was not able to complete the rest. Even though there were less trigonometry, I still found it hard to tell my robot when to stop turning its gun.

I learned that robots were very obedient, if somewhat frustrating in that it was completely obedient. Everything about robocode had to be overly specific, with all contingencies covered. Without this exact specific behavioral programming, the robots tend to either die and mislead you or seem to have developed a mind of its own.

Having a set of code katas helped in refining the robot's behavior, but rather they helped in getting my feet wet. Generally, code katas are good practice. Knowing that I spent time practicing this kind of thing gives me confidence in myself, which is important when people start to ask questions. Unfortunately, even with this, I still do not have any ideas or plans on how to create a competitive robot yet. I am not a very creative person.