FastFish Exercise Set 1 Question 5 protected ArrayList findMoveLocs() { Environment env = environment(); ArrayList emptyNbrs = emptyNeighbors(); Direction oppositeDir = direction().reverse(); Location locationBehind = env.getNeighbor(location(), oppositeDir); ArrayList moveLocations = new ArrayList(); for (int index = 0; index < emptyNbrs.size(); index++ ) { Location neighborLoc = (Location) emptyNbrs.get(index); moveLocations.add(neighborLoc); Direction dirToNeighbor = env.getDirection(location(), neighborLoc); Location nextOver = env.getNeighbor(neighborLoc, dirToNeighbor); if (env.isEmpty(nextOver) && dirToNeighbor.equals(direction())) { moveLocations.add(nextOver); } } moveLocations.remove(locationBehind); return moveLocations; }