Wednesday, September 5, 2007

Code Ruler Redux

LINK TO CODE:
http://www2.hawaii.edu/~eykim/eykimv2.zip


MEMBERS: Like before, I did this homework on my own but I'm seriously considering doing the other project with a partner from now on.


RESULTS:
I decided that I needed to work on improving the code that deals with the peasants. I decided that just moving them randomly was not enough. I noticed that most of the sample ruler tried to go after the peasants at first so I decided to give them a chase. I wrote code that would check the area around each peasant for any opponent and moved in the opposite direction of the opponent.
It took me a long time to actually develop code that wouldn't give off errors and the resulting code was actually pretty ugly. But I got it cleaned up and it got the job done. I noticed that when I faced off against gang up ruler, I stood a much better chance of survival due to the fact that gang up ruler would send all his knights after my peasants. My peasants on the other hand avoided the knights pretty well giving my castle plenty of time to create more knights to ultimately defeat gang up ruler's knights.
Split up ruler was a completely different story. It seemed like I faired worse than before when it came to split up ruler. Split up ruler completely destroyed my peasants before they even had a chance to run. Afterward they would attack all my knights and I usually ended up with either no minions or sending countless knights to their doom. This was one error that I wish I had more time to fix. I noticed that if I was left with just a few knights and a castle, all my knights would just attack the castle a few at a time. Split up ruler would kill these few knights and gain incredibly high points off of it.

SCORES:

               `My score      enemy

split 122 446

split 137 416

split 168 407



migrate 596 11

migrate 577 16

migrate 559 9



gang up 376 224

gang up 382 282

gang up 294 373


LESSON LEARNED:
I've learned that to truly develop code is an on going process and that no code is really ever done. There will always be some kind of improvement that could be made. Everything from studying the problem from all angles to collaborating with my fellow students can greatly improve the quality of code that I write. I should have made better use of these resources.
I also realized that as I delved deeper and deeper into my strategy, the more complicated the code became and the more frustrated I've become. After looking at other people's code, I noticed that complicated strategies with endless condition usually faired the best. I tried to emulate this strategy but eventually ran out of time. I honestly thought that my modifications to the peasant's code would be enough. But it was not and left me with a hard learned lesson.

No comments: