uh, nobody else seems to have noticed, but the ants do NOT have a very complex AI - they appear to be capable of turns up to 90 degrees at a time, and have simulated random movement. the only thing that makes them seem to be so very intelligent is that the game simulates the scent trails real ants use. whenever an ant walks in a square, the game probably lays information telling which direction an ant going into that square should leave it, so whenever an ant enters a square with scent trail data, it has a high probability of following that trail, if it can make the turn required. Otherwise, it just moves randomly.
i'm REALLY certain this is the case - you'll notice that the ants tend to all follow the same path, and often they follow a path through your weakest defenses? Not because they analysed it, but because the scent trail will be stronger wherever more ants have made it through - where they're less likely to die.
this makes it really annoying because i just tried a cake-oriented defense, and all six ants started following the leader, making a perfect strength trail, and the leader found the back end of his own trail, and now they're making a loopy circle outside my range. haven't gotten a single shot off, it's been 20 minutes now.
I also think they tend to avoid leaving a square in the opposite direction of a scent trail - if the scent trail says go NW, they don't like to leave the square going SE. this sorta prevents them from wandering back and forth accidentally?
there might be a second type of scent trail for an ant carrying cake - real ants use multiple trails, this would make sense.
This is why you sometimes have ants staying in your gun-cage for the longest time, they're not afraid, it's just that they don't have any trails out to follow. with this in mind, always try to kill any ant that looks like it's gonna form a trail out.