Wednesday, September 5, 2007

Code Ruler Redux

We have made several improvements to our Code Ruler program. The result turned out to be quite well, and our ruler now stands a higher chance against the Split Up Ruler. The source code can be found here.

The first improvement is the movement of the peasants. After several modifications of the code, we are finally able to move the peasants in a more effective way: now it will not move into the already-captured square whenever is possible. This is the same idea we had before, but the old code did not work correctly. Also, we got rid of the center-moving of the early peasant movement, since it is only a compromise strategy for the old incorrect code and it is no longer needed.

The second improvement is the strategy we used for the knights. Since we found out that capturing castles does not give points, and our knights would only end up trying to capture the castle, we decided to change the targets. We assign the knight with an arbitrary target, which is not necessarily a castle, and we make the knight tries to capture anything that is on its way. This is a much more aggressive strategy, and it seems working well.

The last improvement is the coding style. We changed indentation to two spaces, added spaces and curly braces for readability, etc. we have tried our best to match the standard Java style.

No comments: