Other 2014 FR Questions FR other years Be Prepared Home
A-2
public class Director extends Rock
{
  public Director()
  {
    super(Color.RED);
  }
  
  public void act()
  {
    if (getColor().equals(Color.GREEN))
    {
      ArrayList<Actor> neighbors = getGrid().getNeighbors(getLocation());
      for (Actor a : neighbors)
        a.setDirection(a.getDirection() + Location.RIGHT); 1
      setColor(Color.RED);
    }
    else
      setColor(Color.GREEN);
  }
}
Notes:
  1. Or, simply:
      a.setDirection(a.getDirection() + 90);

Other 2014 FR Questions | Back to Contents

Copyright © 2014 by Skylight Publishing
support@skylit.com