public boolean ScanOrganism(Organism o) {
   WorldObject wo;
   try {
     wo = sworld.senseAhead(o);
   } catch (UnsupportedSenseException e) {
     throw new RuntimeException(e);
   }
   if (wo == null) return false;
   return wo.isOrganism();
 }
 public void Mate(MattingOrganism o) {
   WorldObject wo;
   try {
     wo = sworld.senseAhead(o);
   } catch (UnsupportedSenseException e) {
     throw new RuntimeException(e);
   }
   if (wo == null) return;
   if (!wo.isOrganism()) return;
   o.mate(wo.getOrganism());
 }
  public void Attack(AttackingOrganism o) {
    WorldObject wo;
    try {
      wo = sworld.senseAhead(o);
    } catch (UnsupportedSenseException e) {
      throw new RuntimeException(e);
    }
    if (wo == null) return;

    o.attack(wo);
  }
 public double ScanBlue(Organism o) {
   WorldObject wo;
   try {
     wo = sworld.senseAhead(o);
   } catch (UnsupportedSenseException e) {
     throw new RuntimeException(e);
   }
   if (wo == null) return 0;
   if (!wo.isOrganism()) {
     return 0;
   }
   return wo.getOrganism().color(2) / 255;
 }
  public GPSimpleBrainFunctions(World w) {
    if (!(w instanceof MovableWorld))
      throw new InvalidParameterException("Excepted MovableWorld world");
    if (!(w instanceof SensableWorld))
      throw new InvalidParameterException("Excepted SensableWorld world");

    world = w;
    sworld = (SensableWorld) w;
    mworld = (MovableWorld) w;

    if (!sworld.getSenseStyle().contains(SenseStyle.AHEAD))
      throw new InvalidParameterException("Excepted SensableWorld world with SenseStyle.AHEAD");

    if (!mworld.getMoveStyle().contains(MoveStyle.FORWARD))
      throw new InvalidParameterException("Excepted MovableWorld world with MoveStyle.FORWARD");

    if (!mworld.getMoveStyle().contains(MoveStyle.ROTATE))
      throw new InvalidParameterException("Excepted MovableWorld world with MoveStyle.ROTATE");
  }