public void tick() {
   for (int i = 0; i < people.size(); i++) {
     Person mainPerson = people.get(i);
     int lastX = mainPerson.getPosX();
     int lastY = mainPerson.getPosY();
     mainPerson.move();
     for (int j = 0; j < people.size(); j++) {
       if (i != j) {
         Person otherPerson = people.get(j);
         if ((mainPerson.getPosX() == otherPerson.getPosX())
             && (mainPerson.getPosY() == otherPerson.getPosY())) {
           mainPerson.setPosX(lastX);
           mainPerson.setPosY(lastY);
           if (areCompatable(mainPerson, otherPerson)) {
             Person baby = getChild(mainPerson, otherPerson);
             people.add(baby);
           }
         }
       }
     }
     mainPerson.setAge(mainPerson.getAge() + 1);
     if (mainPerson.getAge() > 100) {
       people.remove(i);
     }
   }
   for (int i = 0; i < people.size(); i++) {
     if ((people.get(i).getPosX() < 0)
         || (people.get(i).getPosX() > 28)
         || (people.get(i).getPosY() < 0)
         || (people.get(i).getPosY() > 17)) {
       people.remove(i);
     }
   }
 }
 public static Person getChild(Person mom, Person dad) {
   Gene hairGene = Gene.combineGenes(mom.getHairGene(), dad.getHairGene());
   Gene eyeGene = Gene.combineGenes(mom.getEyeGene(), dad.getEyeGene());
   return new Person(hairGene, eyeGene, 0, mom.getPosX(), mom.getPosY() + 1);
 }