To try and efficiently gather food, I did a breadth first search from every food at the same time. I setup some python generators to look for targets (my ants) 1 step at a time. When I found a target, I committed to the move and added a new target ant at the time it would be at the new spot. This allowed me to schedule 1 ant to pick up several foods if it was the closest to each one, freeing up the other ants to do something else. I also added a future ant at the hill so the first ant would tend to collect in 1 direction and the new ant would have orders waiting for him.
Food gathering happened after combat so an ant wouldn't flee the front lines. Targeting enemy hills and ants was done afterwards, which caused ants to not raze a hill and gather food instead.
My bfs code only recorded the first and last direction for each target, not the full path, so I could search from ants to food or food to ants. I wrote a second bfs that just recorded distances that I used for exploration and was faster, but never got around to using it for food. That means I redid the calculations each turn without caching.
Playing on TCP, there were only a few bots that gathered faster than my bot, and usually by luck of exploring a better area first.
I thought about trying to get a few ants to ignore food and look for and steal food closer to the enemy, but never got there. Sort of a dodge ball rush at the start. I also thought about trying to collect all food I saw in the shortest amount of time, but figured a few ants sooner would be better, as I would always find more food.https://gist.github.com/1507173
For the python experts, you'll notice my generators are producing and collecting values, a big no-no in python land.