// Dog critters always infect if an enemy is in front of it. When they are not // infecting, they turn left five times and then hop once. They are colored // pink and they display how many left turns they have made since they last // tried to hop (initially 0, then 1, then 2, ..., eventually becoming 5, then // going back to 0, 1, 2, ...). import java.awt.*; public class Dog extends Critter { private int count; public Action getMove(CritterInfo info) { if (info.getFront() == Neighbor.OTHER) { return Action.INFECT; } else if (count < 5) { count++; return Action.LEFT; } else { count = 0; return Action.HOP; } } public Color getColor() { return Color.PINK; } public String toString() { return "" + count; } }