Monday, September 14, 2009

Robocode 2.0

Rarely is one's code perfect on the first try, if there ever is such a thing as perfect code. There is always room for improvement and as such I revised my Robocode robots in two ways. I edited my code to follow coding standards and I looked at my peers' Robocode to improve my robots.

Coding standards are very important in programming because it creates a consistent environment to work in which in turn improves readability, allowing for easier debugging, maintaining, and extending. If it wasn't for coding standards, programmers would be responsible for coming up with their own "style" and have to figure out others' style. One would get caught up in the little details and waste time that would otherwise be spent on programming.

The coding standards I used for my revised version of Robocode robots include:
I also looked at my classmates' code and found some things that would help improve my robots. I used Kendyll Doi's method of moving my robot to the center of the battle field in my Movement04. I also used Lyneth Peou's getDegree, getDistance, and moveRobot methods which were more versitle than the original methods I had that could only be used in certain situations.

One problem I had with coding standards while using others code however, was the first rule in The Elements of Java Style of "Adhere to the style of the original." For my Tracking robots I had modified the sample Tracker robot. I did end up changing some of the documentation for the borrowed code because it did not follow the coding standards I was using even though part of the standards was to adhere to the style of the original. I felt that I was taking a small enough amount of code that I could easily change.

Link to my revised Robocode robots: link

0 comments:

Post a Comment