예제 #1
0
 internal static List<Phenomenon> help(List<Phenomenon> list, World world)
 {
     foreach (Phenomenon worldPhenomenon in world.getPhenomenonList())
     {
         for (int index = 0; index < list.Count; index++)
         {
             if (list[index].getLocation() == worldPhenomenon.getLocation())
             {
                 worldPhenomenon.refresh();
                 list.RemoveAt(index);
             }
         }
     }
     return list;
 }
예제 #2
0
 public void move(World world)
 {
     if (job == State.RANDOM_MOVEMENT)
     {
         switch (direction)
         {
         case Direction.NORTH:
             location.Y--;
             break;
         case Direction.EAST:
             location.X--;
             break;
         case Direction.SOUTH:
             location.Y++;
             break;
         case Direction.WEST:
             location.X++;
             break;
         default:
             throw new Exception("Direction is not recognized: " + direction);
         }
         randomizeMovement();
         grabFood(world.getFoodList());
     }
     else if (job == State.SMELLING_PHENOMENON)
     {
         moveToPhenomenon();
     }
     else if (job == State.GOING_TO_NEST)
     {
         if (phenomenonAmount > 0)
             dropPhenomenon(world);
         goToNest();
     }
     handleToroidalBounds(world.getHeight(), world.getWidth());
 }
예제 #3
0
 private void setUpWorld()
 {
     world = new World(AntsWorld.Width, AntsWorld.Height, antList, foodList, nest);
 }
예제 #4
0
 private void dropPhenomenon(World world)
 {
     phenomenonAmount = (int)(phenomenonAmount - (phenomenonAmount * 0.025f));
     spreadPhenomenon((int)(phenomenonAmount * 0.1f));
     phenomenonList = HelperClass.help(phenomenonList, world);
     world.createPhenomenonSpot(phenomenonList);
     phenomenonList.Clear();
 }
예제 #5
0
 internal void update(World world)
 {
     if(job == State.RANDOM_MOVEMENT)
         smell(world.getPhenomenonList());
     move(world);
 }