Ejemplo n.º 1
0
        public Garden makeChild(int length, int width, List <Resident> rocks, int movementMax)
        {
            Garden child        = new Garden(length, width);
            Random gen          = new Random();
            Point  tempLocation = new Point();

            foreach (Resident rock in rocks)
            {
                tempLocation    = rock.origin;
                tempLocation.X += gen.Next(-1 * movementMax, movementMax);
                tempLocation.Y += gen.Next(-1 * movementMax, movementMax);
                tempLocation.X  = (tempLocation.X + width) % width;
                tempLocation.Y  = (tempLocation.Y + length) % length;

                child.addResident(new Rock(rock.length, rock.width), tempLocation, false);
            }
            child.fillWithGravel();
            if (child.getAllOfType(Rock.rockString).Count != rocks.Count)
            {
                child = makeChild(length, width, rocks, movementMax);
            }

            Console.WriteLine(child);

            return(child);
        }
Ejemplo n.º 2
0
 public void fillWithGravel()
 {
     testGarden.fillWithGravel();
 }