Monday, September 24, 2007

11.WebSpider

Download available Here

Summary
At first glance, this seemed like a rather simple program. Once I began working, however, that perception changed. Despite the setbacks, I accomplished all 3 tasks. I did not attempt the extra credit.

Task 1:
The importance of program design and planning was very important in this stage. The later tasks would rely heavily on how this task was implemented. As such, I spent quite a lot of time trying to come up with a good design. Despite my efforts, however, my design was not able to smoothly incorporate the required features for Tasks 2 and 3.

Task 2:
I completely redesigned my program from Task 1. I added a new class and a TreeMap to hold the required information about the most popular link. It became clear during these tasks that emma and coverage driven testing are quite uselss. Even with nearly 100% coverage, very few errors were found and much time was wasted trying to get the coverage to 100%. In the future I will focus more on writing "good" unit tests rather then very specific ones that get more coverage.

Task 3:
The logger system was very easy to use. I only had to add a few lines of code and it was working fine. The only problem I had was getting the javac compiler to recognize the Hackystat logger. I was only able to test it in eclipse. Please note that the .jar file contains a version with the logger commented out. To test the logger, please recompile the source.

Conclusions
Good tests can be very helpful, but bad ones can be a waste of time. The amount of time I wasted on emma would have been must better used writing more effective tests. Next time I plan on spending less time with emma and more time with just junit.

Monday, September 17, 2007

10.Stack

Download zip file Here

Task Overview
I was able to complete all five tasks successfully. I came across several problems during this assignment, all of which I was able to overcome.

The process of downloading and installing ant, all of the tools, and setting all the environment variables was rather simple. The instructions were straightforward and I was easily able to get my version of the Stack project could pass the "verify" script.

The most difficult part of this project, for me, was creating the javancss.build.xml file. I have quite a bit of HTML experience but I have never used XML. I had several problems with the path variables required by JavaNCSS. However, after going over the other build files provided and looking at the samples given on the JavaNCSS Website, I was able to accomplish this task.

The final task involved running emma and increasing the coverage to 100% by writing additional test cases. I really liked this tool. It provided very clear information and can make it much easier to write meaningful test cases.

Conclusions
Some of theses tools may be very useful in the development of software projects. However, I think they are all not necessary. The most useful, I feel, are CheckStyle, FindBugs, PMD, and emma. SCLC and JavaNCSS both provide similar information, yet JavaNCSS provides a little bit more (Cyclomatic Complexity Number, etc.). I do not see the information provided by these two tools as being very useful in most software development projects. All the other tools, however, were very helpful and I could see using them in the future. They may even help me break my "bad" habit of putting opening braces on their own lines.

Tuesday, September 4, 2007

08.CodeRulerRedux

The newest version of my CodeRuler bot can be found

Here

After cleaning up my code to fit the Java conventions, I carefully read the review of my bot. There were several areas that the reviewer felt I could improve my bot. I considered every suggestion and tried to improve my strategy.

The first area I tried to improve was the knight AI. The reviewer mentioned that fleeing when faced with a stronger enemy may not be the best approach. I realized that, while dying needlessly should be avoided, knights should try to weaken the enemy forces until they are on the verge of death. I, therefore, added a condition that only allows knights to flee if they are under half health.

Another area that needed attention was the peasant AI. They covered ground very well, avoided enemy knights, claimed land quite efficiently. The problem was that they would get stuck after a certain point. I tried solving this problem in many different ways. First, I tried taking every square on the map into consideration while scoring, thus preventing equal scoring of all directions. This caused a timeout immediately. I then tried the same strategy, evaluating only every 5 squares. This prevented them from moving within 5 squares of the walls. I ended up staying with my previously strategy, as the peasants would eventually claim the entire board. I left this attempted strategy in the source code (commented out).

I added one final tweak that helps increase my score. Once I control 70 peasants, all castles should create knights. Since knights are worth more points then peasants in the final score, this can increase your score slightly when you have completely wiped out the enemy. It does not matter in a close game, but in a complete victory it will increase your score.

From this revision of my Code Ruler, I realized that many of my coding habits do not follow the convention. I will try to break all of my bad coding habits. Certain things (like giving an opening bracket its own line) I will may always prefer, but I can now try to follow a more universally accepted standard.