I'm glad you liked it! The ant AI was pretty complicated. To put it simply, the ants have many motives, some stronger than others depending on their surroundings, time, and some RNG. As more directives were added their desire to do any specific action and essentially "attention span" shrank, which is a natural tendency of ants in real life. I tried my best to get the AI as perfect as possible, working with someone who researches swarm and insect behavior.
Edit: Each ant is roughly 300 lines of code :)