Wednesday, August 29, 2007

Code Ruler Results

Member: Shaoxuan Zhang

Source Code: http://www2.hawaii.edu/~sz/ics613/sz.zip

Strategy:
- Castle produce to maintain a certain proportion between knights and peasants.
- Peasants claim the land that isn't belongs to the rule and avoid being attacked. Otherwise, it move to a random direction.
- Knights are grouped into two, one assault team one castle capture team.
-- Castle capture team capture castle one by one, and destroy enemies' target around its way or near the castle.
-- Assault team capture castles only, do not attack any other enemy units. If no castles remain, they will wait in the center of the map for orders.

Test results:
Test 1 Test 2 Test 3
sz vs. Migrate 820:0 784:0 797:0
sz vs. Gang Up 780:60 796:78 785:42
sz vs. Split Up 773:54 844:56 749:54


Lessons learnt:
CodeRuler: I now have understand some strategy of CodeRuler. Most of them have been implemented into my Ruler. Both my peasants and knights have advantage.
Peasant: Instead of move randomly, my peasants now know to move and claim an unclaimed land first. It is significant to accelerate the speed of claimming land, and contributes to mine beating Migrate Ruler to 0 points. In most of the test, my ruler claimed as much as 4000 land which means 85% of the world! In test of more player, this number can reach 4602, which just 6 fewer than the world. I think it is strong enough. Some intelligent strategy may farther improve this one, but the improvement will not worth the expense in calculation.
Another advantage is to avoid enemies' knight. The peasant will move away from the enemy knight if it is near. This feature not only make my peasants more safe, but also waste enemies' force to pursue the peasants. Sometimes, we can see other ruler's knight running after my peasants across over the world. Though my peasant sacrifices at last, it win me lot of time to capture the ruler's defendless castle.
Knight: The idea of spliting into two teams comes from the sample Split Up ruler, and it prove to be useful. The assault team can usually find and capture a empty castle.
However, the most important idea is to sweep out the way to the target castle, especially in one on one game when both rulers' knight is moving to others. When raiding not only capture enemy unit on the way, but also near the way, it will act as defending when attacking, especially for the knight that newly created from the castle. I think this idea is the most important one to help me win.
Castle: Castle's strategy is simple, just manage the proportion between knights and peasants and stop creating knights when enemy runs few.

Java, Eclipse and Programming: Actually, I did not get much new in Eclipse, just get more used to it. For Java, this assignment is a very good exercise of writing javadoc. After I generate my javadoc files, I do consider it helpful! I think I will continue practise and use it the future.
Then I would like to talk about programming. I got two experiences: the first is to design well before writing code, the second is to write more methods to group up the functions. Both these two are fundamental indeed, but now I have fully realized them. I have writen the ruler twice. The first time I wrote it without carefully design. So my ruler cannot even beat the Gang Up Ruler. The second time I rewrote it with careful design and used more nested method calling, that prove to be very helpful when lately I want to modify my strategy.

Working with another person? I worked alone in this project, so... no experience in this aspect.

No comments: