Exemplo n.º 1
0
 /**
  * The given robot shoots in the direction it is facing.
  *
  * @param robot The robot that has to execute this command.
  * @effect The given robot shoots in the direction it is facing, provided it has the energy to
  *     do so.
  */
 @Override
 public void execute(Robot robot) {
   try {
     if (robot.getEnergy().compareTo(Robot.getEnergyToShoot()) != -1) robot.shoot();
   } catch (NullPointerException exc) {
     System.err.println(exc.getMessage());
   }
 }