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; }
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()); }
private void setUpWorld() { world = new World(AntsWorld.Width, AntsWorld.Height, antList, foodList, nest); }
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(); }
internal void update(World world) { if(job == State.RANDOM_MOVEMENT) smell(world.getPhenomenonList()); move(world); }