We had our first code war at Windward this Friday, which I am dubbing Windward Code War One! It's a battle to see who can write the best solution to a problem in a relatively short period of time. My team, Nuclear Pony, lost horribly. So let me share my thoughts with you about this, and feel free to give me your own. If you want the code (original and final), hit the link above.
For this challenge, we had to write AIs to play in the strategy board game, Broadside. Basically, you get a set of ships; each one has a certain number of sails, and when it gets hit, you lose a sail. You get hit when a boat moves into the square adjacent to yours with their broadside facing your ship. In addition to that, you also have islands in the water, and surrounding land where you can place a couple of batteries (cannons) that will hit any opponent that passes the square in front of them.
I thought a lot about why we failed so badly. Our AI's moves were all considered invalid, except for our first two setup-moves; and so aside from the small edge we got from those, we had nothing, and experienced complete devastation. I could say a lot about what happened, but I think it ultimately ties to one simple lesson.
Test Early, Test Often
Basically, we over-spent on planning. We developed a truly fearsome strategy before we even started coding. But this cut out some much needed debugging time which left us with failing software. We should have written some code earlier, so that we could find the hang-ups earlier, and have more time to figure them out. In this case, I'm quite sure we would have hit our major hang-ups right away, and if we did, we would have been able to make a couple minor changes in implementation that would have corrected the invalid moves problem (take a look at the final code if you want to see if you agree with me). Even if our strategy had not been as great as I think it was, we would have been a lot happier to see it performing as we had intended.
In My Element
While I was truly disappointed in my own performance - and quite embarrassed, I admit - I absolutely had a blast! Time flying. Lost in the moment. Hacking with hardly a thought of anything else (leaving me quite thirsty after the event was over). This is my utopia!
I hope you found this insightful and/or inspiring, but in any case, happy coding!