Source code: gnat
As you can see it's pretty basic, but what I did to make it work was have a "gnat" jump to a random position within a certain range. The position swayed in the direction of the "food" this way the gnat jumps around randomly but with an overall movement towards the food.
Built with Processing