Write the modified method in the class. The method processes actors as before, act Critter act each neighboring adjacent that is neither a nor another Then it uses a “eating” Actor Rock Critter. random number to determine whether this will breed or not. If the random number is within Critter the probability range for breeding, the will breed; otherwise it will move as in the original Critter act method. Complete method below. act /** * A critter acts by getting a list of its neighbors, and * processing them. If it passes the probability test for * breeding, then it breeds into each of the empty neighboring * locations. If not, it gets the possible locations to move * to, selects one of them, and moves to the selected location. */ public void act()
Write the modified act method in the Critter class. The act method processes actors as before, “eating” each neighboring adjacent Actor that is neither a Rock nor another Critter. Then it uses a random number to determine whether this Critter will breed or not. If the random number is within the probability range for breeding, the Critter will breed; otherwise it will move as in the original act method. Complete method act below. /** * A critter acts by getting a list of its neighbors, and * processing them. If it passes the probability test for * breeding, then it breeds into each of the empty neighboring * locations. If not, it gets the possible locations to move * to, selects one of them, and moves to the selected location. */ public void act()
practice_exam_3.docx