If not safe, foragers do MOVETOGROUP, which means that a forager moves towards the center of its group, calculated as the mean position of the other members of its group (Fig. 1 b, first line). Once safe, the forager then aligns its own heading with the average direction of other members of its group in ALIGNSPACE (20 meters). This attraction-alignment algorithm ensures that foragers stay together but travel in a relatively efficient manner through the environment.