I recently took part in a nice contest hosted at aichallenge.org. For those of you who don't know about it, it's a series of coding contests revolving around AI. This particular game was 'Ants'. Basically, you controlled an ant colony while they tried to raze enemy hills, collect food, and protect your own ant hill. It was a very good idea and I have nothing but praise for those who organized it :) I did quite well in my country finishing 2nd, but my code was poorly written and choppy so I'm not going to share it unless people ask for it.
The first thing I did was restructure the "starter bot" you were given. I completely tore it apart and re-implemented it. This helped me a lot more as I continued and I think I'll ignore the starter bot next time around and just go with my own code.
If you didn't compete in this one, do compete in the next one. They're great fun and I learned a staggering amount while I was going along. There's a great sense of community, especially on the IRC channel (who always helped me out :) ) and I can't wait for the next one. (Psssst, rumor has it it could be Asteroids ;) )