private Planet getPlanetNotOwnedByPlayer(List<Planet> planets, Player player) {
   for (Planet testPlanet : planets) {
     if (testPlanet.getOwner() == null || !testPlanet.getOwner().equals(player)) {
       return testPlanet;
     }
   }
   return null;
 }
  private Planet getStrongestPlayerPlanet(List<Planet> planets, Player player) {
    Planet strongestPlanet = getPlanetOwnedByPlayer(planets, player);

    for (Planet testPlanet : planets) {
      if (testPlanet.getOwner() != null && testPlanet.getOwner().equals(player)) {
        if (testPlanet.getNumberOfShips() > strongestPlanet.getNumberOfShips()) {
          strongestPlanet = testPlanet;
        }
      }
    }
    return strongestPlanet;
  }
  private Planet getClosestWeakerPlanet(
      List<Planet> planets, Player player, Planet playerPlanet, int attackingFleetSize) {
    Planet closestPlanet = playerPlanet;
    double shortestDistance = Double.MAX_VALUE;

    for (Planet testPlanet : planets) {
      if ((testPlanet.getOwner() == null || !testPlanet.getOwner().equals(player))
          && !closestPlanet.equals(testPlanet)) {

        double distance = testPlanet.getCoordinates().distance(closestPlanet.getCoordinates());
        if (distance < shortestDistance && attackingFleetSize > testPlanet.getNumberOfShips()) {
          shortestDistance = distance;
          closestPlanet = testPlanet;
        }
      }
    }
    if (closestPlanet.equals(playerPlanet)) {
      return null;
    }
    return closestPlanet;
  }