Class TourFourmi

java.lang.Object
fr.formiko.formiko.interfaces.TourFourmi
All Implemented Interfaces:
Tour, Serializable
Direct Known Subclasses:
TourFourmiNonIa, TourReine

public class TourFourmi extends Object implements Serializable, Tour
Ant implementation.
Allow an ant to play a turn
Author:
Hydrolien
See Also:
  • Field Details

  • Constructor Details

    • TourFourmi

      public TourFourmi()
  • Method Details

    • setF

      public void setF(Fourmi fTemp)
    • unTour

      public void unTour(Creature c)
      PLay 1 turn with Creature f.
      Specified by:
      unTour in interface Tour
      Parameters:
      c - The Creature that need to play a turn.
    • tour

      public void tour()
      Do turn actions for an ant.
      • 1a the ant try to survive.
      • Then it help any friendly ant in the same case.
      • Then it get more food.
      • Finaly it back home and share food with other.
    • endTurn

      public void endTurn(Creature c)
      End a turn as an Ant.
      If turn have already be end on this turn, it will do nothing.
      Specified by:
      endTurn in interface Tour
      Parameters:
      c - The Creature that need to end a turn.
    • endTurn

      public void endTurn()
      End a turn as an Ant.
      If turn have already be end on this turn, it will do nothing.
    • cleanItself

      public void cleanItself()
      To be sur that the ant will be clean.
    • feedOther

      public void feedOther(int foodToQueep)
      Give food by trophallaxis if other ant need it.
      An Ant try to give all it food exept foodToQueep%.
      An ant try to give food if : it have action left, it have more food than foodToQueep%, it can use Trophallaxie interface.
    • aNourrir

      public Creature aNourrir()
      Search the ant that need the more food.
      We 1a feed our ant queen if it wantFood.
      We 2a feed every creature that is concidered as an ally & want food.
      Finaly we try to feed the queen even if she didn't absolutly need food.
    • cleanOther

      public void cleanOther()
      Clean if other ant need it.
    • aNetoyer

      public Creature aNetoyer()
      Search the ant that need the more to be clean.
      We 1a clean our ant queen if it wantClean.
      We 2a clean every creature that is concidered as an ally & want clean.
    • backHomeAndShareFood

      public void backHomeAndShareFood()
      Back home and share food to the Creature that need it.
    • backHome

      public void backHome()
      Back home.
      We find the direction to be closer to the anthill. And then we go there.