I didn't quite understand the ants behaviours, like moving sand around, but thoroughly enjoyed this simulation. Cute.
I'm glad you found it cute and enjoyable! I completely agree their behaviors need a lot more love, but I am ready to give it! :)
The actions of the workers are just probabilistic for now - they lack any true motivation.
The queen ant has an instinctual goal of creating a sufficiently spacious nest that is sufficiently deep underground. When she achieves that goal, she stops movement and begins giving birth to ants. Those ants then dig out the nest further.
I am trying to figure out how to make the digging more... inspired? Something like "If ants keep finding themselves surrounded by other ants underground then they need more space and should consider digging" or "If an ant fails to find a place to put food then it should consider digging"
I think that both of these things have a prerequisite of having tunnels/chambers built more effectively, though. I've played around with some rules like "Don't dig dirt if there is air on the opposite side of the dirt" in an attempt to prevent the nest from turning into a giant pit, but this doesn't result in tunnels and chambers, just delays the inevitable pit-like behavior.
In the future, there will be an "outer world" which has the more classic "ant follow pheromone trails to find food" mechanism. You'll see ants disappear out the sides of this view and see them explore from a top-down view. The outer world will get covered in fog each night and push all the ants back to their nest for sleeping and eating. Just trying to get to the point where they sensibly store food before expanding into that.
.. and if that was more info than you were looking for, sorry :D Just excited to talk about my thing.
I wish I could help you figure it out, but I don't know much about these types of algorithms. Possibly, they already exist and you can plug them in. I know there's a lot of work done on maze-generation in games, maybe you can think of the tunnels as a maze, and pre-generate a path they will take, and update that model as other ants interact with it. Anyway I love the enthusiasm and wish you luck!
Have a good day!