StockpileCritter free response answer

The StockpileCritter problem from the 2009 AP Computer Science Exam is typical of free response problems that test GridWorld: The AP Computer Science Case Study. The problem requires you to extend the Critter class, determine which methods to override, and implement the entire subclass.


public class StockpileCritter extends Critter
  private int stockpile = 0;
  public void processActors(ArrayList<Actor> actors)
    for(Actor a : actors)
  public Location selectMoveLocation(ArrayList<Location> locs)
    if(stockpile < 0)
      return null;
      return super.selectMoveLocation(locs);

Review the StockpileCritter free response problem with AP CS Tutor Brandon Horn.

Get AP CS Help

2009 AP CS Exam Solutions & Explanations

Recommended Practice Problems