Wednesday, August 29, 2007

Code Ruler Result

I finished the Code Ruler program with my partner, Zhong Rong Lao (Jon Lao). The zip file of the source code can be found in here.

As for the strategy evaluation, since I implemented the strategy as competing with all three other rulers, it turned out to be a little surprising when I did the one-on-one competition with each ruler for the homework. Nevertheless, I am still satisfied with the result, here is a table showing the score of each run:



Test Run: 1st run 2nd run 3rd run
jliao-rong/migrate 570/0 616/5 623/17
jliao-rong/gang up 461/167 523/120 544/104
jliao-rong/split up 58/563 264/412 417/190

The strategy I used is quite simple: at the beginning of the match, move the peasant to the center of the map, then span out from there. This gives me a faster way to cover 124 squares, which is the minimum to produce more units. Also at the same time, I move my knights towards other castles and try to capture them. If there are enemy peasants or knights on the way, capture them as well, but the castles are always the primary targets. This strategy seems to be working a lot better when there are more than two rulers competing. Even though the strategy is simple, but implement it is not very easy. There are still minor errors, such as the rarely-happen overtime. However, due to the time constrain and programming ability, we are unable to fix these minor bugs.

On the other hand, I learned a lot from this assignment. First of all, I am very happy to see how eclipse has helped me to find out many typo-kind mistakes, such as the missing semicolon. Also, the debugger along with the break-point is very handy, and it helped me solved many errors that were hard to notice by simply running the program. Secondly, the Code Ruler is a very funny game. Trying to implement a strategy to beat up the computer is not only a great pleasure, but also is a very challenging task. Java has played an important role here. The javadoc of Code Ruler is very clear, which helped me to understand the program faster. Lastly, working with another person is a great experience. I had worked in teams before, in my opinion, communication is the most important thing for the success of the team. With good communication, a team works as one person, but performs better than one person; with bad communication, a team works as more than one person, but perform worse than one person.

No comments: