Implementation of the flocking algorithms