/** * Check whether or not this fox is to give birth at this step. * New births will be made into free adjacent locations. * @param newFoxes A list to return newly born foxes. */ public void Breed() { List <Location> free = field.GetFreeAdjacentLocations(location); Litter.Clear(); for (int b = 0; b < newBirths && free.Count > 0; b++) { Location loc = free[0]; free.RemoveAt(0); Fox young = new Fox(false, field, loc); Litter.Add(young); } }
/** * Check whether or not this rabbit is to give birth at this step. * New births will be made into free adjacent locations. * New born rabbits are added to the Litter. */ public void Breed() { // New rabbits are born into adjacent locations. // Get a list of adjacent free locations. List <Location> free = field.GetFreeAdjacentLocations(location); Litter.Clear(); for (int b = 0; b < newBirths && free.Count > 0; b++) { Location loc = free[0]; free.RemoveAt(0); Rabbit young = new Rabbit(false, field, loc); Litter.Add(young); } }