A simulation of variation in spatial memory on territory formation and mating success