Ejemplo n.º 1
0
 // finds the actors around it, for every actor, if its a bad knight nothing happens,
 // but if it's eny other critter it will fight with it, producing a random victor.
 public void processActors(ArrayList<Actor> actors) {
   for (Actor a : actors) {
     if (((a instanceof Critter && !(a instanceof BadKnight)))) {
       a.removeSelfFromGrid();
     }
   }
 }
Ejemplo n.º 2
0
  /**
   * Randomly selects a neighbor and changes this critter's color to be the same as that neighbor's.
   * If there are no neighbors, no action is taken.
   */
  public void processActors(ArrayList<Actor> actors) {
    int n = actors.size();
    if (n == 0) return;

    for (Actor a : actors) {
      if (a instanceof Rock) a.removeSelfFromGrid();
    }
  }