I implemented version 2 of my Code Ruler code alone. The link to the code is below:
CodeRulerRedux Implementation
After looking through The Elements of Java Style book along with our own standards, I modified and implemented code that adheres to the Java coding and documentation standards. As far as strategy for the actual game, I saw an interesting for loop in Jianfei Liao and Jon Lao's code that heavily influenced my own method for capturing enemies as a group. It looked around for enemies that were next to each individual knight and captured them as it came across them. That seemed to work much better than the method I had come up for capturing all enemies in a particular grid area. Also, I saw that they went after castles first and then after enemies, which was different from my code because I just went after the nearest enemy. After modifying my code to capture castles first, I noticed that it was much more effective than just capturing the nearest enemy. I also learned from Michal and Chiao-Fen Zielinski's code that you could actually control what type of unit (knight or peasant) your castle produced, so I immediately modified my code to take advantage of this discovery!
Version 2 of my ruler dominated Migrate Ruler, Gang Up Ruler, and Split Up Ruler. The results of tests are shown below:
Version 2 Test Results:
My Ruler vs. Migrate Ruler
1: 982 - 0 W
2: 984 - 0 W
3: 988 - 0 W
My Ruler vs. Gang Up Ruler
1: 877 - 120 W
2: 914 - 86 W
3: 931 - 66 W
My Ruler vs. Split Up Ruler
1: 904 - 64 W
2: 869 - 116 W
3: 898 - 94 W
The results were much better than my previous results (shown below) because I went 9-0 instead of 5-4 and the scores were much more consistent in that I consistently won by a large amount. It seems that my currently strategy works with all types of rulers whereas my previous strategy struggled with Split Up Ruler. Overall, I think the biggest difference between Version 2 and Version 1 is that Version 2 controls the unit production much, much better than Version 1 and my capture strategy is much more effective now that I go after castles first and capture any enemy next to my knights.
Version 1 Test Results:
My Ruler vs. Migrate Ruler
1: 934 - 0 W
2: 958 - 0 W
3: 936 - 0 W
My Ruler vs. Gang Up Ruler
1: 812 - 98 W
2: 641 - 526 W
3: 36 - 600 L
My Ruler vs. Split Up Ruler
1: 157 - 635 L
2: 356 - 485 L
3: 86 - 627 L
From this assignment, I learned proper Java coding and documentation standards, gained a better understanding of Eclipse, and learned the value in looking at other people's code. I think all three of these lessons will prove to be tremendously valuable as the semester goes on.
No comments:
Post a Comment