public int getSumStuff() {
    if (waypoints.size() > 0) {
      EcState state = defaultDestination();
      for (EcState s : waypoints) {
        state.union(s);
      }
      state.union(this);
      return state.getSumStuff();
    }

    int i =
        hatcheries
            + lairs
            + hives
            + spawningPools
            + evolutionChambers
            + roachWarrens
            + hydraliskDen
            + banelingNest
            + infestationPit
            + greaterSpire
            + ultraliskCavern
            + gasExtractors
            + spire
            + spineCrawlers
            + sporeCrawlers
            + nydusNetwork
            + nydusWorm
            + drones
            + overlords
            + overseers
            + zerglings
            + banelings * 2
            + roaches
            + mutalisks
            + infestors
            + queens
            + hydralisks
            + corruptors
            + ultralisks
            + broodlords * 2;

    if (metabolicBoost) i++;
    if (adrenalGlands) i++;
    if (glialReconstitution) i++;
    if (tunnelingClaws) i++;
    if (burrow) i++;
    if (pneumatizedCarapace) i++;
    if (ventralSacs) i++;
    if (centrifugalHooks) i++;
    if (melee1) i++;
    if (melee2) i++;
    if (melee3) i++;
    if (missile1) i++;
    if (missile2) i++;
    if (missile3) i++;
    if (armor1) i++;
    if (armor2) i++;
    if (armor3) i++;
    if (groovedSpines) i++;
    if (neuralParasite) i++;
    if (pathogenGlands) i++;
    if (flyerAttack1) i++;
    if (flyerAttack2) i++;
    if (flyerAttack3) i++;
    if (flyerArmor1) i++;
    if (flyerArmor2) i++;
    if (flyerArmor3) i++;
    if (chitinousPlating) i++;
    for (EcState s : waypoints) i += s.getSumStuff();
    return i;
  }
  public boolean isSatisfied(EcState candidate) {

    if (waypoints.size() > 0) {
      EcState state = defaultDestination();
      for (EcState s : waypoints) {
        state.union(s);
      }
      state.union(this);
      return state.isSatisfied(candidate);
    }

    if (candidate.drones < drones) return false;
    if (candidate.zerglings < zerglings) return false;
    if (candidate.banelings < banelings) return false;
    if (candidate.roaches < roaches) return false;
    if (candidate.mutalisks < mutalisks) return false;
    if (candidate.queens < queens) return false;
    if (candidate.hydralisks < hydralisks) return false;
    if (candidate.infestors < infestors) return false;
    if (candidate.corruptors < corruptors) return false;
    if (candidate.ultralisks < ultralisks) return false;
    if (candidate.broodlords < broodlords) return false;
    if (candidate.overlords < overlords) return false;
    if (candidate.overseers < overseers) return false;

    if (candidate.bases() < requiredBases) return false;
    if (candidate.lairs < lairs) return false;
    if (candidate.hives < hives) return false;
    if (candidate.gasExtractors < gasExtractors) return false;
    if (candidate.spawningPools < spawningPools) return false;
    if (candidate.banelingNest < banelingNest) return false;
    if (candidate.roachWarrens < roachWarrens) return false;
    if (candidate.hydraliskDen < hydraliskDen) return false;
    if (candidate.infestationPit < infestationPit) return false;
    if (candidate.spire < spire) return false;
    if (candidate.greaterSpire < greaterSpire) return false;
    if (candidate.ultraliskCavern < ultraliskCavern) return false;
    if (candidate.evolutionChambers < evolutionChambers) return false;
    if (candidate.spineCrawlers < spineCrawlers) return false;
    if (candidate.sporeCrawlers < sporeCrawlers) return false;
    if (candidate.nydusNetwork < nydusNetwork) return false;
    if (candidate.nydusWorm < nydusWorm) return false;

    if ((!candidate.metabolicBoost) & metabolicBoost) return false;
    if ((!candidate.adrenalGlands) & adrenalGlands) return false;
    if ((!candidate.glialReconstitution) & glialReconstitution) return false;
    if ((!candidate.tunnelingClaws) & tunnelingClaws) return false;
    if ((!candidate.burrow) & burrow) return false;
    if ((!candidate.pneumatizedCarapace) & pneumatizedCarapace) return false;
    if ((!candidate.ventralSacs) & ventralSacs) return false;
    if ((!candidate.centrifugalHooks) & centrifugalHooks) return false;
    if ((!candidate.melee1) & melee1) return false;
    if ((!candidate.melee2) & melee2) return false;
    if ((!candidate.melee3) & melee3) return false;
    if ((!candidate.missile1) & missile1) return false;
    if ((!candidate.missile2) & missile2) return false;
    if ((!candidate.missile3) & missile3) return false;
    if ((!candidate.armor1) & armor1) return false;
    if ((!candidate.armor2) & armor2) return false;
    if ((!candidate.armor3) & armor3) return false;
    if ((!candidate.groovedSpines) & groovedSpines) return false;
    if ((!candidate.neuralParasite) & neuralParasite) return false;
    if ((!candidate.pathogenGlands) & pathogenGlands) return false;
    if ((!candidate.flyerAttack1) & flyerAttack1) return false;
    if ((!candidate.flyerAttack2) & flyerAttack2) return false;
    if ((!candidate.flyerAttack3) & flyerAttack3) return false;
    if ((!candidate.flyerArmor1) & flyerArmor1) return false;
    if ((!candidate.flyerArmor2) & flyerArmor2) return false;
    if ((!candidate.flyerArmor3) & flyerArmor3) return false;
    if ((!candidate.chitinousPlating) & chitinousPlating) return false;

    if (EcSettings.overDrone || EcSettings.workerParity) {
      int overDrones = getOverDrones(candidate);

      if (EcSettings.overDrone && candidate.drones < overDrones) {
        return false;
      }
      if (EcSettings.workerParity) {
        int parityDrones = getParityDrones(candidate);

        if (candidate.drones < parityDrones) {
          return false;
        }
      }
    }

    return true;
  }