示例#1
0
 /**
  * Remove the specified zone from the zone picker
  *
  * @param zone the zone to remove
  * @return The zone that was removed
  */
 public Zone remove(Zone zone) {
   Color color = zone.getPickColor();
   int pixelColor = color.getAlpha() + (color.getRGB() << 8);
   Zone removed = zoneMap.remove(pixelColor);
   zone.setPickColor(null);
   return removed;
 }
示例#2
0
  /**
   * Add a zone to the zone picker.
   *
   * @param zone the zone to enable picking on.
   */
  public void add(Zone zone) {
    // check if we already have this zone
    if (zoneMap.containsValue(zone)) return;

    if (zoneMap.size() == POSSIBLE_COLORS) {
      // We've run out of pick colours :( oh no
      System.err.printf(
          "The number of zones has exceeded the maximum number of pickable zones (%d). This recently added zone (%s) will not be pickable.",
          POSSIBLE_COLORS, zone);
      return;
    }

    // get a new colour
    zone.setPickColor(new Color(currentColor, false));
    int pixelColor = 0xff + (currentColor << 8);
    zoneMap.put(pixelColor, zone);

    // dont bother searching if we're out of colours anyways
    if (zoneMap.size() < POSSIBLE_COLORS) {
      while (zoneMap.containsKey(pixelColor)) {
        currentColor += 1;
        pixelColor = 0xff + (currentColor << 8);
      }
    }

    // add all of the zone's child zones
    for (Zone child : zone.getChildren()) this.add(child);
  }
示例#3
0
  /**
   * Get the Zone under the specified coordinates.
   *
   * @param x x coordinate of the specified pixel
   * @param y y coordinate of the specified pixel
   * @return If there is a Zone at the specified coordinates, that zone, otherwise null.
   */
  public Zone pick(int x, int y) {
    // clamp x and y
    if (y >= picking_context.height) y = picking_context.height - 1;
    if (x >= picking_context.width) x = picking_context.width - 1;
    if (y < 0) y = 0;
    if (x < 0) x = 0;

    PGL pgl = picking_context.beginPGL();
    int pixel;
    // force fallback until 2.0b10
    if (!SMT.fastPickingEnabled() || pgl == null) {
      // really slow way(max 70 fps on a high end card vs 200+ fps with readPixels), with loadPixels
      // at the end of render()
      pixel = picking_context.pixels[x + y * picking_context.width];
    } else {
      buffer.clear();
      pgl.readPixels(x, picking_context.height - y, 1, 1, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, buffer);
      pixel = buffer.getInt();
    }
    picking_context.endPGL();

    if (zoneMap.containsKey(pixel)) {
      // if mapped it is either a Zone or null (background)
      Zone picked = zoneMap.get(pixel);
      Zone current = picked;
      while (current != null) {
        if (current.stealChildrensTouch) return current;
        current = current.getParent();
      }
      return picked;
    } else return null;
  }
 public static PrimarySpiderDiagram getVennABCDiagramWithPartlyShadedBAndSpiderInZoneBC_A() {
   PrimarySpiderDiagram modelDiagram = getVennABCDiagramWithPartlyShadedB();
   HashMap<String, Region> habitats = new HashMap<>();
   habitats.put("s", new Region(Zone.fromInContours("B", "C").withOutContours("A")));
   return SpiderDiagrams.createPrimarySD(
       asList("s"), habitats, modelDiagram.getShadedZones(), modelDiagram.getPresentZones());
 }
 @Test
 public void
     areContoursDisjoint_should_return_true_when_the_spiders_are_not_in_the_shared_shaded_zones() {
   TreeMap<String, Region> habitats = new TreeMap<>();
   String spider = "s";
   habitats.put(spider, new Region(Zone.fromInContours("A", "C").withOutContours("B", "D")));
   Set<Zone> present = new HashSet<>();
   present.add(Zone.fromOutContours("A", "B", "C", "D"));
   PrimarySpiderDiagram diagramWithASpiderInTheIntersection =
       SpiderDiagrams.createPrimarySD(
           asList(spider),
           habitats,
           getZonesInsideAllContours(POWER_REGION_ABCD, "A", "D"),
           present);
   ContourRelations contourRelations = new ContourRelations(diagramWithASpiderInTheIntersection);
   assertTrue(contourRelations.areContoursDisjoint("A", "D"));
 }
 @Test
 public void areContoursDisjoint_should_return_false_when_not_all_shared_zones_are_shaded() {
   Set<Zone> present = new HashSet<>();
   present.add(Zone.fromOutContours("A", "B", "C", "D"));
   ContourRelations contourRelations =
       new ContourRelations(
           SpiderDiagrams.createPrimarySD(
               null, null, getZonesInsideAllContours(POWER_REGION_ABCD, "A", "B", "C"), present));
   assertFalse(contourRelations.areContoursDisjoint("A", "D"));
 }
示例#7
0
  private void passThrough(ZoneMessage msg) {
    ZoneVO vo = dbf.findByUuid(msg.getZoneUuid(), ZoneVO.class);
    if (vo == null && allowedMessageAfterSoftDeletion.contains(msg.getClass())) {
      ZoneEO eo = dbf.findByUuid(msg.getZoneUuid(), ZoneEO.class);
      vo = ObjectUtils.newAndCopy(eo, ZoneVO.class);
    }

    if (vo == null) {
      ErrorCode err =
          errf.instantiateErrorCode(
              SysErrors.RESOURCE_NOT_FOUND,
              String.format(
                  "unable to find zone[uuid:%s], it may have been deleted", msg.getZoneUuid()));
      bus.replyErrorByMessageType((Message) msg, err);
      return;
    }

    ZoneFactory factory = this.getZoneFactory(ZoneType.valueOf(vo.getType()));
    Zone zone = factory.getZone(vo);
    zone.handleMessage((Message) msg);
  }
示例#8
0
 // TODO: This could be a single listener for all zones
 private void addTokenChangeListeners() {
   for (Zone zone : MapTool.getCampaign().getZones()) {
     if (modelChangeListeners.containsKey(zone) == false) {
       modelChangeListeners.put(
           zone,
           new ModelChangeListener() {
             @Override
             public void modelChanged(ModelChangeEvent event) {
               System.out.println("DEBUG: Event " + event.eventType);
               if (event.eventType == Zone.Event.TOKEN_CHANGED) {
                 tokenChanged((Token) event.getArg());
               } else if (event.eventType == Zone.Event.TOKEN_ADDED) {
                 tokenAdded((Token) event.getArg());
               } else if (event.eventType == Zone.Event.TOKEN_REMOVED) {
                 tokenRemoved((Token) event.getArg());
               }
             }
           });
       zone.addModelChangeListener(modelChangeListeners.get(zone));
     }
   }
 }
public class ContourRelationsTest {

  private final Zone zoneAB = Zone.fromInContours("A", "B");
  private final Zone zoneB_A = Zone.fromInContours("B").withOutContours("A");
  private final ArrayList<Zone> powerRegionAB = allZonesForContours("A", "B");
  private final PrimarySpiderDiagram diagramWithContoursAB =
      SpiderDiagrams.createPrimarySD(null, null, null, powerRegionAB);
  private final PrimarySpiderDiagram diagramWithShadedB =
      SpiderDiagrams.createPrimarySD(null, null, asList(zoneB_A, zoneAB), powerRegionAB);
  private final PrimarySpiderDiagram diagramWithShadedIntersection =
      SpiderDiagrams.createPrimarySD(null, null, asList(zoneAB), powerRegionAB);

  @Test
  public void areContoursDisjoint_should_return_false_in_a_Venn_diagram() {
    ContourRelations contourRelations = new ContourRelations(diagramWithContoursAB);
    assertFalse(contourRelations.areContoursDisjoint("A", "B"));
  }

  @Test(expected = IllegalArgumentException.class)
  public void
      areContoursDisjoint_should_throw_an_exception_if_any_of_the_contours_is_not_in_the_diagram() {
    new ContourRelations(diagramWithContoursAB).areContoursDisjoint("C", "D");
  }

  @Test
  public void areContoursDisjoint_should_return_true_when_zone_AsubB_is_shaded() {
    ContourRelations contourRelations = new ContourRelations(diagramWithShadedIntersection);
    assertTrue(contourRelations.areContoursDisjoint("A", "B"));
  }

  @Test
  public void areContoursDisjoint_should_return_false_when_not_all_shared_zones_are_shaded() {
    Set<Zone> present = new HashSet<>();
    present.add(Zone.fromOutContours("A", "B", "C", "D"));
    ContourRelations contourRelations =
        new ContourRelations(
            SpiderDiagrams.createPrimarySD(
                null, null, getZonesInsideAllContours(POWER_REGION_ABCD, "A", "B", "C"), present));
    assertFalse(contourRelations.areContoursDisjoint("A", "D"));
  }

  @Test
  public void
      areContoursDisjoint_should_return_true_when_there_are_multiple_zones_and_all_shared_zones_are_shaded() {
    Set<Zone> present = new HashSet<>();
    present.add(Zone.fromOutContours("A", "B", "C", "D"));
    ContourRelations contourRelations =
        new ContourRelations(
            SpiderDiagrams.createPrimarySD(
                null, null, getZonesInsideAllContours(POWER_REGION_ABCD, "A", "D"), present));
    assertTrue(contourRelations.areContoursDisjoint("A", "D"));
  }

  @Test
  public void
      areContoursDisjoint_should_return_false_when_there_are_any_spiders_in_the_shared_shaded_zones() {
    TreeMap<String, Region> habitats = new TreeMap<>();
    String spider = "s";
    habitats.put(spider, new Region(Zone.fromInContours("A", "C", "D").withOutContours("B")));
    Set<Zone> present = new HashSet<>();
    present.add(Zone.fromOutContours("A", "B", "C", "D"));
    PrimarySpiderDiagram diagramWithASpiderInTheIntersection =
        SpiderDiagrams.createPrimarySD(
            asList(spider),
            habitats,
            getZonesInsideAllContours(POWER_REGION_ABCD, "A", "D"),
            present);
    ContourRelations contourRelations = new ContourRelations(diagramWithASpiderInTheIntersection);
    assertFalse(contourRelations.areContoursDisjoint("A", "D"));
  }

  @Test
  public void
      areContoursDisjoint_should_return_true_when_the_spiders_are_not_in_the_shared_shaded_zones() {
    TreeMap<String, Region> habitats = new TreeMap<>();
    String spider = "s";
    habitats.put(spider, new Region(Zone.fromInContours("A", "C").withOutContours("B", "D")));
    Set<Zone> present = new HashSet<>();
    present.add(Zone.fromOutContours("A", "B", "C", "D"));
    PrimarySpiderDiagram diagramWithASpiderInTheIntersection =
        SpiderDiagrams.createPrimarySD(
            asList(spider),
            habitats,
            getZonesInsideAllContours(POWER_REGION_ABCD, "A", "D"),
            present);
    ContourRelations contourRelations = new ContourRelations(diagramWithASpiderInTheIntersection);
    assertTrue(contourRelations.areContoursDisjoint("A", "D"));
  }

  @Test
  public void contourContainsAnother_should_return_false_for_a_Venn_diagram() {
    ContourRelations contourRelations = new ContourRelations(diagramWithContoursAB);
    assertFalse(contourRelations.contourContainsAnother("A", "B"));
  }

  @Test(expected = IllegalArgumentException.class)
  public void
      contourContainsAnother_should_throw_an_exception_when_the_contours_are_not_contained_in_the_diagram() {
    ContourRelations diagramContourRelations = new ContourRelations(diagramWithContoursAB);
    diagramContourRelations.contourContainsAnother("A", "C");
  }

  @Test
  public void
      contourContainsAnother_should_return_true_when_the_other_contour_is_entirely_shaded() {
    ContourRelations diagramContourRelations = new ContourRelations(diagramWithShadedB);
    assertTrue(diagramContourRelations.contourContainsAnother("A", "B"));
  }

  @Test
  public void
      contourContainsAnother_should_return_false_when_the_other_contour_is_not_entirely_shaded() {
    ContourRelations diagramContourRelations =
        new ContourRelations(getVennABCDiagramWithShadedBC());
    assertFalse(diagramContourRelations.contourContainsAnother("A", "B"));
  }

  @Test
  public void contourContainsAnother_should_return_false_when_the_other_contour_is_not_shaded() {
    ContourRelations diagramContourRelations = new ContourRelations(diagramWithContoursAB);
    assertFalse(diagramContourRelations.contourContainsAnother("A", "B"));
  }

  @Test
  public void contourContainsAnother_should_return_true_when_the_only_unshaded_part_of_B_is_in_A() {
    ContourRelations diagramContourRelations =
        new ContourRelations(getVennABCDiagramWithPartlyShadedB());
    assertTrue(diagramContourRelations.contourContainsAnother("A", "B"));
  }

  @Test
  public void
      contourContainsAnother_should_return_false_when_the_only_unshaded_part_of_B_is_in_A_but_there_is_a_spider_in_B() {
    ContourRelations diagramContourRelations =
        new ContourRelations(getVennABCDiagramWithPartlyShadedBAndSpiderInZoneBC_A());
    assertFalse(diagramContourRelations.contourContainsAnother("A", "B"));
  }

  public static PrimarySpiderDiagram getVennABCDiagramWithPartlyShadedB() {
    ArrayList<Zone> zonesBC = Zones.getZonesInsideAllContours(POWER_REGION_ABC, "B");
    zonesBC.remove(Zone.fromInContours("A", "B", "C"));
    return SpiderDiagrams.createPrimarySD(null, null, zonesBC, POWER_REGION_ABC);
  }

  public static PrimarySpiderDiagram getVennABCDiagramWithShadedBC() {
    ArrayList<Zone> zonesBC = Zones.getZonesInsideAllContours(POWER_REGION_ABC, "B", "C");
    return SpiderDiagrams.createPrimarySD(null, null, zonesBC, POWER_REGION_ABC);
  }

  public static PrimarySpiderDiagram getVennABCDiagramWithPartlyShadedBAndSpiderInZoneBC_A() {
    PrimarySpiderDiagram modelDiagram = getVennABCDiagramWithPartlyShadedB();
    HashMap<String, Region> habitats = new HashMap<>();
    habitats.put("s", new Region(Zone.fromInContours("B", "C").withOutContours("A")));
    return SpiderDiagrams.createPrimarySD(
        asList("s"), habitats, modelDiagram.getShadedZones(), modelDiagram.getPresentZones());
  }
}
 public static PrimarySpiderDiagram getVennABCDiagramWithPartlyShadedB() {
   ArrayList<Zone> zonesBC = Zones.getZonesInsideAllContours(POWER_REGION_ABC, "B");
   zonesBC.remove(Zone.fromInContours("A", "B", "C"));
   return SpiderDiagrams.createPrimarySD(null, null, zonesBC, POWER_REGION_ABC);
 }
示例#11
0
  public Point getNextPositionBasedOnZone(int dogNum) {
    // System.out.println("getting next position based on zone");
    Point currentPosition = dogs[dogNum];
    int zoneNumber = dogToZone.get(dogNum);
    Zone myZone = zones.get(zoneNumber);
    // System.out.println("got my zone");
    /*
    If there are more dogs than zones, then there will be multiple dogs per zone. Therefore we will be assigning
    multiple dogs to a zone, and tier determines which sheep they target. Tier = 0 means that they target the farthest sheep in that zone,
    tier = 1 means they will get the second farthest sheep, etc. To assign tiers we just take all the dogs in the zone and sort them
    by their ID and then assign sequentially.
    */
    ArrayList<Integer> dogsInThisZone = myZone.getDogIndices(dogs);
    Collections.sort(dogsInThisZone);
    int tier = dogsInThisZone.indexOf(dogNum);
    ArrayList<Integer> sortedSheep =
        getDistanceSortedIndices(myZone.getGoal(), myZone.getSheepIndices(this.sheeps));
    // System.out.println("got sorted sheep");

    // NEW: if the dog's original zone is different than its current zone, and the dog's original
    // zone is not empty, dog should be reassigned to original zone
    int originalZoneNumber = originalDogToZone.get(dogNum);
    if (originalZoneNumber != zoneNumber) {
      if (zones.get(originalZoneNumber).hasSheep(this.sheeps)) {
        System.out.println(
            "My current zone is "
                + zoneNumber
                + " but my original zone, "
                + originalZoneNumber
                + ", has no sheep. Going back to that zone");
        dogToZone.put(dogNum, originalZoneNumber);
        zoneNumber = originalZoneNumber;
        myZone = zones.get(originalZoneNumber);
      }
    }
    // end new

    if (myZone.hasSheep(this.sheeps)) {
      if (tier == -1) {
        tier = 0;
      } else if (tier >= sortedSheep.size()) {
        // If a dog is delivering sheep to the goal and has nothing to deliver, then get it out of
        // the way
        if (Calculator.pointsEqual(myZone.goalPoint, Zone.GATE)) {
          System.out.println("I am moving toward doghouse!");
          return Calculator.getMoveTowardPoint(currentPosition, Zone.DOGHOUSE);
        } else {
          System.out.println("I have nothing to deliver, staying at current position");
          return currentPosition;
        }
      }
      System.out.println("chasing sheep toward goal");
      return chaseSheepTowardGoal(dogNum, sortedSheep.get(tier), myZone.getGoal());
      // The dog's zone is currently empty, reassign the dog's zone
    } else {
      /*
      Find the zone with the fewest number of sheep that is > 0 and move the dog to that location
      But don't move it to a zone that is a goal zone because that introduces clogging
      */

      // distribute the dogs more evenly?
      System.out.println("my zone is empty (line 153), trying to reassign!");

      if (Calculator.pointsEqual(myZone.goalPoint, Zone.GATE)) {
        System.out.println(
            "My zone is the zone closest to the goal, not reassigning. But I am not moving, so this is bad--TO FIX!");
        return currentPosition;
      }

      /*ArrayList<Integer> sortedZones = getNumSheepSortedZones();
      for (int i = 0; i < sortedZones.size(); i++) {
          Zone tmpZone = zones.get(sortedZones.get(i));
          if (Calculator.pointsEqual(tmpZone.goalPoint, Zone.GATE)) {
              continue;
          }

          int numSheep = zones.get(sortedZones.get(i)).numSheep(sheeps);
          if (numSheep > 0) {
              dogToZone.put(dogNum, sortedZones.get(i));
              return Calculator.getMoveTowardPoint(dogs[dogNum], tmpZone.getCenter());
          }
      }*/
      // NEW: we always want a dog to move toward a middle zone if its zone is empty. here, we hard
      // code what the dog should do based on what its zone is
      int totalZones = zones.size();
      if (totalZones == 1) {
        System.out.println("Code should never get here unless we have completed the scenario");
      } else if (totalZones == 2) {
        if (zoneNumber == 1) {
          dogToZone.put(dogNum, 0);
          System.out.println("I have zone 1, now taking zone 0");
        } else {
          System.out.println(
              "I am in zone 0 and it is empty, but I will have sheep soon so I am not moving!");
          return currentPosition;
        }
      } else if (totalZones == 3) {
        if (zoneNumber == 1 || zoneNumber == 2) {
          dogToZone.put(dogNum, 0);
          System.out.println("I have zone " + zoneNumber + ", now taking zone 0");
        } else {
          System.out.println("I am in zone 0 and it is empty, but I will have sheep soon!");
          return currentPosition;
        }
      } else if (totalZones == 4) {
        if (zoneNumber != 1) {
          dogToZone.put(dogNum, 1);
          System.out.println("I have zone " + zoneNumber + ", now taking zone 1");
        } else {
          System.out.println("I am in zone 0 and it is empty, but I will have sheep soon!");
          return currentPosition;
        }
      } else if (totalZones == 5) {
        if (zoneNumber == 0) {
          if (zones.get(1).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 1);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 1");
          } else if (zones.get(2).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 2);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 2");
          } else {
            System.out.println(
                "I am in zone 0 and it is empty, but so are the top and bottom goal zones. Somewhere will have sheep soon!");
            return currentPosition;
          }

        } else if (zoneNumber == 1) {
          if (zones.get(3).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 3);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 3");
          } else if (zones.get(2).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 2);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 2");
          } else {
            System.out.println(
                "I am in the top goal zone and it is empty, but so are 3 and 2. Somewhere will have sheep soon!");
            return currentPosition;
          }
        } else if (zoneNumber == 2) {
          if (zones.get(4).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 4);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 4");
          } else if (zones.get(2).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 2);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 2");
          } else {
            System.out.println(
                "I am in the bottomgoal zone and it is empty, but so are 4 and 2. Somewhere will have sheep soon!");
            return currentPosition;
          }
        } else if (zoneNumber == 3) {
          if (zones.get(0).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 0);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 0");
          } else if (zones.get(1).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 1);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 1");
          } else {
            System.out.println(
                "I am in zone 3 and it is empty but so are 0 and 1. Somewhere will have sheep soon!");
            return currentPosition;
          }
        } else if (zoneNumber == 4) {
          if (zones.get(0).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 0);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 0");
          } else if (zones.get(2).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 2);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 2");
          } else {
            System.out.println(
                "I am zone 4 and it is empty but so are 0 and 2. Somewhere will have sheep soon!");
            return currentPosition;
          }
        }
      } else if (totalZones == 6) {
        if (zoneNumber == 0) {
          if (zones.get(3).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 3);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 3");

          } else if (zones.get(2).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 2);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 2");
          } else if (zones.get(1).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 1);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 1");
          } else {
            System.out.println(
                "I am zone 0 and it is empty but so are 1, 3 and 2. Somewhere will have sheep soon!");
            return currentPosition;
          }
        } else if (zoneNumber == 1) {
          if (zones.get(2).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 2);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 2");

          } else if (zones.get(3).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 3);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 3");
          } else if (zones.get(0).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 0);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 0");
          } else {
            System.out.println(
                "I am zone 1 and it is empty but so are 3, 0 and 2. Somewhere will have sheep soon!");
            return currentPosition;
          }
        } else if (zoneNumber == 2) {
          if (zones.get(3).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 3);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 3");

          } else {
            System.out.println(
                "I am zone 2 and it is empty but so is 3. Somewhere will have sheep soon!");
            return currentPosition;
          }
        } else if (zoneNumber == 3) {
          if (zones.get(2).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 2);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 2");

          } else {
            System.out.println(
                "I am zone 3 and it is empty but so is 2. Somewhere will have sheep soon!");
            return currentPosition;
          }
        } else if (zoneNumber == 4) {
          if (zones.get(2).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 2);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 2");

          } else if (zones.get(1).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 1);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 1");
          } else if (zones.get(3).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 3);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 3");
          } else {
            System.out.println(
                "I am zone 4 and it is empty but so are 3, 1 and 2. Somewhere will have sheep soon!");
            return currentPosition;
          }
        } else if (zoneNumber == 5) {
          if (zones.get(3).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 3);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 3");

          } else if (zones.get(0).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 0);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 0");
          } else if (zones.get(2).hasSheep(this.sheeps)) {
            dogToZone.put(dogNum, 2);
            System.out.println("I have zone " + zoneNumber + ", now taking zone 2");
          } else {
            System.out.println(
                "I am zone 5 and it is empty but so are 3, 0 and 2. Somewhere will have sheep soon!");
            return currentPosition;
          }
        } else if (totalZones == 7) {
          if (zoneNumber == 0) {
            if (zones.get(1).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 1);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 1");

            } else if (zones.get(2).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 2);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 2");
            } else {
              System.out.println(
                  "I am zone 0 and it is empty but so are 1 and 2. Somewhere will have sheep soon!");
              return currentPosition;
            }
          } else if (zoneNumber == 1) {
            if (zones.get(2).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 2);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 2");
            } else {
              System.out.println(
                  "I am zone 1 and it is empty but so is 2. Somewhere will have sheep soon!");
              return currentPosition;
            }
          } else if (zoneNumber == 2) {
            if (zones.get(1).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 1);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 1");
            } else {
              System.out.println(
                  "I am zone 2 and it is empty but so is 1. Somewhere will have sheep soon!");
              return currentPosition;
            }
          } else if (zoneNumber == 3) {
            if (zones.get(0).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 0);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 0");
            } else if (zones.get(5).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 5);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 5");
            } else {
              System.out.println(
                  "I am zone 3 and it is empty but so are 0 and 5. Somewhere will have sheep soon!");
              return currentPosition;
            }
          } else if (zoneNumber == 4) {
            if (zones.get(0).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 0);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 0");
            } else if (zones.get(6).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 6);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 6");
            } else {
              System.out.println(
                  "I am zone 4 and it is empty but so are 0 and 6. Somewhere will have sheep soon!");
              return currentPosition;
            }
          } else if (zoneNumber == 5) {
            if (zones.get(1).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 1);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 1");
            } else if (zones.get(3).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 3);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 3");
            } else if (zones.get(2).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 2);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 2");
            } else {
              System.out.println(
                  "I am zone 5 and it is empty but so are 5, 3, and 2. Somewhere will have sheep soon!");
              return currentPosition;
            }
          } else if (zoneNumber == 6) {
            if (zones.get(2).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 2);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 2");
            } else if (zones.get(4).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 4);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 4");
            } else if (zones.get(1).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 1);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 1");
            } else {
              System.out.println(
                  "I am zone 6 and it is empty but so are 4, 2, and 1. Somewhere will have sheep soon!");
              return currentPosition;
            }
          }
        } else { // total zones > 7
          if (zoneNumber == 0) {
            if (zones.get(3).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 3);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 3");
            } else if (zones.get(1).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 1);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 1");
            } else if (zones.get(2).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 2);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 2");
            } else {
              System.out.println(
                  "I am zone 0 and it is empty but so are 1, 3, and 2. Somewhere will have sheep soon!");
              return currentPosition;
            }
          } else if (zoneNumber == 1) {
            if (zones.get(2).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 2);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 2");
            } else if (zones.get(0).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 0);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 0");
            } else if (zones.get(3).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 3);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 3");
            } else {
              System.out.println(
                  "I am zone 1 and it is empty but so are 0, 3, and 2. Somewhere will have sheep soon!");
              return currentPosition;
            }
          } else if (zoneNumber == 2) {
            if (zones.get(3).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 3);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 3");
            } else {
              System.out.println(
                  "I am zone 2 and it is empty but so is 3. Somewhere will have sheep soon!");
              return currentPosition;
            }
          } else if (zoneNumber == 3) {
            if (zones.get(2).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 2);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 2");
            } else {
              System.out.println(
                  "I am zone 3 and it is empty but so is 2. Somewhere will have sheep soon!");
              return currentPosition;
            }
          } else if (zoneNumber == 4) {
            if (zones.get(1).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 1);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 1");
            } else if (zones.get(6).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 6);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 6");
            } else if (zones.get(2).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 2);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 2");
            } else {
              System.out.println(
                  "I am zone 4 and it is empty but so are 1, 6, and 2. Somewhere will have sheep soon!");
              return currentPosition;
            }
          } else if (zoneNumber == 5) {
            if (zones.get(0).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 0);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 0");
            } else if (zones.get(7).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 7);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 7");
            } else if (zones.get(3).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 3);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 3");
            } else {
              System.out.println(
                  "I am zone 5 and it is empty but so are 7,3,0. Somewhere will have sheep soon!");
              return currentPosition;
            }
          } else if (zoneNumber == 6) {
            if (zones.get(2).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 2);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 2");
            } else if (zones.get(4).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 4);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 4");
            } else {
              System.out.println(
                  "I am zone 6 and it is empty but so are 2,4. Somewhere will have sheep soon!");
              return currentPosition;
            }
          } else {
            if (zones.get(3).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 3);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 3");
            } else if (zones.get(5).hasSheep(this.sheeps)) {
              dogToZone.put(dogNum, 5);
              System.out.println("I have zone " + zoneNumber + ", now taking zone 5");
            } else {
              System.out.println(
                  "I am zone 5 and it is empty but so are 3,7. Somewhere will have sheep soon!");
              return currentPosition;
            }
          }
        }
      }

      System.out.println("finished else...");
      return Calculator.getMoveTowardPoint(currentPosition, myZone.getCenter());
    }
  }