FastFish Exercise Set 1 Question 4 protected ArrayList findMoveLocs() { Environment env = environment(); ArrayList emptyNbrs = emptyNeighbors(); Direction oppositeDir = direction().reverse(); 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(oppositeDir))) { moveLocations.add(nextOver); } } return moveLocations; }