simulations.core.strategy.completeStrategy
Class CompleteStrategy

java.lang.Object
  extended by simulations.core.strategy.Strategy
      extended by simulations.core.strategy.completeStrategy.CompleteStrategy
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
GenericComposedStrategy, RandomStrategy

public abstract class CompleteStrategy
extends Strategy
implements java.io.Serializable, java.lang.Cloneable

This abstract class describes haw to construct an attack strategy

See Also:
Serialized Form

Field Summary
protected  java.util.Vector askingStrategyVector
          The asking strategies to use
protected  java.util.Vector attackStrategyVector
          The attack strategies to use in order
protected  java.util.Vector decisionStrategyVector
          The decision strategies to use
 
Fields inherited from class simulations.core.strategy.Strategy
abr, memory, name, randomGenerator
 
Constructor Summary
CompleteStrategy()
          Creates a new instance of CompleteStrategy
CompleteStrategy(java.util.Vector attackStrategyVector, java.util.Vector askingStrategyVector, java.util.Vector decisionStrategyVector)
          Creates a new instance of CompleteStrategy
 
Method Summary
 boolean equals(java.lang.Object o)
          overload of equals method
 java.lang.String getAskingComposition()
          Return the composition of the asking list
 java.util.Vector getAskingStrategyVector()
          Getter for property askingStrategyVector.
 java.lang.String getAttackComposition()
          Return the composition of the attack list
 java.util.Vector getAttackStrategyVector()
          Getter for property attackStrategyVector.
 java.lang.String getDecisionComposition()
          Return the composition of the decision list
 java.util.Vector getDecisionStrategyVector()
          Getter for property decisionStrategyVector.
abstract  java.lang.String getDescription()
          return the description of this strategy
abstract  java.util.ArrayList getPlayersToAskSupport(Player player, Player attackedPlayer, java.util.ArrayList playerList)
          Returns the list of players to ask support.
abstract  Player getPlayerToAttack(Player player, java.util.ArrayList playerList)
          return the player to attack
 void setAskingStrategyVector(java.util.Vector askingStrategyVector)
          Setter for property askingStrategyVector.
 void setAttackStrategyVector(java.util.Vector attackStrategyVector)
          Setter for property attackStrategyVector.
 void setDecisionStrategyVector(java.util.Vector decisionStrategyVector)
          Setter for property decisionStrategyVector.
abstract  boolean supportAttack(Player player, Player attackingPlayer, Player attackedPlayer, java.util.ArrayList playerList)
          return true if the player will support the attack.
abstract  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
abstract  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.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
 

Field Detail

attackStrategyVector

protected java.util.Vector attackStrategyVector
The attack strategies to use in order


askingStrategyVector

protected java.util.Vector askingStrategyVector
The asking strategies to use


decisionStrategyVector

protected java.util.Vector decisionStrategyVector
The decision strategies to use

Constructor Detail

CompleteStrategy

public CompleteStrategy()
Creates a new instance of CompleteStrategy


CompleteStrategy

public CompleteStrategy(java.util.Vector attackStrategyVector,
                        java.util.Vector askingStrategyVector,
                        java.util.Vector decisionStrategyVector)
Creates a new instance of CompleteStrategy

Parameters:
attackStrategyVector - The attack strategies to use in order
askingStrategyVector - The asking strategies to use
decisionStrategyVector - The decision strategies to use
Method Detail

getPlayerToAttack

public abstract Player getPlayerToAttack(Player player,
                                         java.util.ArrayList playerList)
                                  throws ManyPlayerToAttackException,
                                         NoPlayerToAttackException
return the player to attack

Parameters:
player - The attacking player
playerList - The list of avalaible player
Returns:
The player to attack
Throws:
ManyPlayerToAttackException - if this method would return more that one player to attack
NoPlayerToAttackException - if this method would return no player to attack

getPlayersToAskSupport

public abstract java.util.ArrayList getPlayersToAskSupport(Player player,
                                                           Player attackedPlayer,
                                                           java.util.ArrayList playerList)
Returns the list of players to ask support.

Parameters:
attackedPlayer - The attacked player
player - The attacking player
playerList - The list of avalaible player
Returns:
Returns the list of players to ask support.

supportAttack

public abstract boolean supportAttack(Player player,
                                      Player attackingPlayer,
                                      Player attackedPlayer,
                                      java.util.ArrayList playerList)
return true if the player will support the attack.

Parameters:
player - The owner of the strategy
attackingPlayer - The attacking player
attackedPlayer - The attacked player
playerList - The player list
Returns:
return true if the player will support the attack.

updateAttacksInfos

public abstract 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

Parameters:
player - The owner of the strategy
attacksList - The list of attacks

updateLastTurn

public abstract void updateLastTurn(Turn turn,
                                    Player player,
                                    java.util.ArrayList remainingPlayers)
This method is called by the judge to inform players of the last turn

Parameters:
turn - The turn
player - The owner of the strategy
remainingPlayers - The list of the remaining players

getDescription

public abstract java.lang.String getDescription()
return the description of this strategy

Specified by:
getDescription in class Strategy
Returns:
return the description of this strategy

getAskingStrategyVector

public java.util.Vector getAskingStrategyVector()
Getter for property askingStrategyVector.

Returns:
Value of property askingStrategyVector.

setAskingStrategyVector

public void setAskingStrategyVector(java.util.Vector askingStrategyVector)
Setter for property askingStrategyVector.

Parameters:
askingStrategyVector - New value of property askingStrategyVector.

getAttackStrategyVector

public java.util.Vector getAttackStrategyVector()
Getter for property attackStrategyVector.

Returns:
Value of property attackStrategyVector.

setAttackStrategyVector

public void setAttackStrategyVector(java.util.Vector attackStrategyVector)
Setter for property attackStrategyVector.

Parameters:
attackStrategyVector - New value of property attackStrategyVector.

getDecisionStrategyVector

public java.util.Vector getDecisionStrategyVector()
Getter for property decisionStrategyVector.

Returns:
Value of property decisionStrategyVector.

setDecisionStrategyVector

public void setDecisionStrategyVector(java.util.Vector decisionStrategyVector)
Setter for property decisionStrategyVector.

Parameters:
decisionStrategyVector - New value of property decisionStrategyVector.

equals

public boolean equals(java.lang.Object o)
overload of equals method

Overrides:
equals in class Strategy
Parameters:
o - The object to compare
Returns:
Returns true if this and o are equals

getAttackComposition

public java.lang.String getAttackComposition()
Return the composition of the attack list

Returns:
the composition of the attack list

getAskingComposition

public java.lang.String getAskingComposition()
Return the composition of the asking list

Returns:
the composition of the asking list

getDecisionComposition

public java.lang.String getDecisionComposition()
Return the composition of the decision list

Returns:
the composition of the decision list