|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimulations.core.strategy.Strategy
simulations.core.strategy.completeStrategy.CompleteStrategy
simulations.core.strategy.completeStrategy.GenericComposedStrategy
public class GenericComposedStrategy
This class describes a generic CompsoedStrategy. We can add attack, asking and decision strategies. This class is generic because to create new Strategies we just have to extends this class and init the attack, asking and decision strategies.
Field Summary |
---|
Fields inherited from class simulations.core.strategy.completeStrategy.CompleteStrategy |
---|
askingStrategyVector, attackStrategyVector, decisionStrategyVector |
Fields inherited from class simulations.core.strategy.Strategy |
---|
abr, memory, name, randomGenerator |
Constructor Summary | |
---|---|
GenericComposedStrategy()
Creates a new instance of GenericComposedStrategy |
|
GenericComposedStrategy(java.lang.String name)
Creates a new instance of GenericComposedStrategy |
Method Summary | |
---|---|
java.lang.String |
getDescription()
return the description of this strategy |
java.util.ArrayList |
getPlayersToAskSupport(Player player,
Player attackedPlayer,
java.util.ArrayList playerList)
Returns the list of players to ask support. |
Player |
getPlayerToAttack(Player player,
java.util.ArrayList playerList)
return the player to attack |
boolean |
supportAttack(Player player,
Player attackingPlayer,
Player attackedPlayer,
java.util.ArrayList playerList)
return true if the player will support the attack. |
void |
updateAttacksInfos(Player player,
java.util.ArrayList attacksList)
This method is called by the judge after the decision of players to attack and to ask supports to inform the strategy |
void |
updateLastTurn(Turn turn,
Player player,
java.util.ArrayList remainingPlayers)
This method is called by the judge to inform players of the last turn |
Methods inherited from class simulations.core.strategy.completeStrategy.CompleteStrategy |
---|
equals, getAskingComposition, getAskingStrategyVector, getAttackComposition, getAttackStrategyVector, getDecisionComposition, getDecisionStrategyVector, setAskingStrategyVector, setAttackStrategyVector, setDecisionStrategyVector |
Methods inherited from class simulations.core.strategy.Strategy |
---|
getAbr, getMemory, getName, getRandomGenerator, setAbr, setMemory, setName, setRandomGenerator, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public GenericComposedStrategy()
public GenericComposedStrategy(java.lang.String name)
name
- The name of the strategyMethod Detail |
---|
public java.lang.String getDescription()
getDescription
in class CompleteStrategy
public Player getPlayerToAttack(Player player, java.util.ArrayList playerList) throws ManyPlayerToAttackException, NoPlayerToAttackException
getPlayerToAttack
in class CompleteStrategy
player
- The attacking playerplayerList
- The list of avalaible player
ManyPlayerToAttackException
- if this method would return more that one player to attack
NoPlayerToAttackException
- if this method would return no player to attackpublic java.util.ArrayList getPlayersToAskSupport(Player player, Player attackedPlayer, java.util.ArrayList playerList)
getPlayersToAskSupport
in class CompleteStrategy
attackedPlayer
- The attacked playerplayer
- The attacking playerplayerList
- The list of avalaible player
public boolean supportAttack(Player player, Player attackingPlayer, Player attackedPlayer, java.util.ArrayList playerList)
supportAttack
in class CompleteStrategy
playerList
- The list of remaining playersplayer
- The owner of the strategyattackingPlayer
- The attacking playerattackedPlayer
- The attacked player
public void updateAttacksInfos(Player player, java.util.ArrayList attacksList)
updateAttacksInfos
in class CompleteStrategy
player
- The player owner of this strategyattacksList
- The list of attackspublic void updateLastTurn(Turn turn, Player player, java.util.ArrayList remainingPlayers)
updateLastTurn
in class CompleteStrategy
turn
- The turnplayer
- The owner of the strategyremainingPlayers
- The list of the remaining players
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |