Note: GridWorld is no longer featured on the AP CS A Exam (since the 2015 Exam).

RockHound processes actors differently than Critter so it must override processActors. Overriding the correct methods of Critter is commonly tested on the AP Computer Science Free Response.

Review the RockHound solution with AP CS Tutor Brandon Horn.

RockHound class

public class RockHound extends Critter
{
    /**
     * Removes all rocks in actors from the grid.
     */
    public void processActors(ArrayList<Actor> actors)
    {
        for(Actor actor : actors)
            if(actor instanceof Rock)
                actor.removeSelfFromGrid();
    }
}

My Critter Class Explanation covers each Critter method including the postcondition, the default implementation, and when the method should be overridden.