/*
* AskingWeakestThanMeStrategy.java
*
* Created on May 16, 2004, 12:34 AM
*/
package simulations.core.strategy.askingSupportStrategy;
import java.util.ArrayList;
import java.util.Iterator;
import simulations.core.Player;
import simulations.core.history.Turn;
/**
* This class describes an asking strategy that ask to all players that have less points than me
* @author tom
*/
public class AskingWeakestThanMeStrategy extends AskingStrategy {
/** Creates a new instance of AskingWeakestThanMeStrategy */
public AskingWeakestThanMeStrategy() {
super();
name="AskingWeakestThanMeStrategy";
memoryParam=false;
abr="7";
}
/** This method returns the description of the strategy
* @return returns the description of the strategy
*/
public String getDescription() {
if (negative) {
return "support : I ask to all players\n"+
"that hava less points than me\n"+
"COMPLEMENTARY";
} else {
return "support : I ask to all players\n"+
"that hava less points than me\n";
}
}
/** Returns the list of players to ask support.
* @return Returns the list of players to ask support.
* @param attackedPlayer The attacked player
* @param player The attacking player
* @param playerList The list of avalaible player
*/
public java.util.ArrayList getPlayersToAskSupport(simulations.core.Player player, simulations.core.Player attackedPlayer, java.util.ArrayList playerList) {
ArrayList l = new ArrayList();
Iterator it = playerList.iterator();
while (it.hasNext()) {
Player p = (Player)it.next();
if (p.getHitPoints()