Package fr.formiko.formiko.interfaces
Class TourFourmi
java.lang.Object
fr.formiko.formiko.interfaces.TourFourmi
- All Implemented Interfaces:
Tour
,Serializable
- Direct Known Subclasses:
TourFourmiNonIa
,TourReine
Ant implementation.
Allow an ant to play a turn
Allow an ant to play a turn
- Author:
- Hydrolien
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaNetoyer()
Search the ant that need the more to be clean.aNourrir()
Search the ant that need the more food.void
backHome()
Back home.void
Back home and share food to the Creature that need it.void
To be sur that the ant will be clean.void
Clean if other ant need it.void
endTurn()
End a turn as an Ant.void
End a turn as an Ant.void
feedOther
(int foodToQueep) Give food by trophallaxis if other ant need it.void
void
tour()
Do turn actions for an ant.void
PLay 1 turn with Creature f.
-
Field Details
-
f
-
-
Constructor Details
-
TourFourmi
public TourFourmi()
-
-
Method Details
-
setF
-
unTour
PLay 1 turn with Creature f. -
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
End a turn as an Ant.
If turn have already be end on this turn, it will do nothing. -
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
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
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. -
backHome
public void backHome()Back home.
We find the direction to be closer to the anthill. And then we go there.
-