games.strategy.triplea.strongAI
Class StrongAI

java.lang.Object
  extended by games.strategy.triplea.baseAI.AbstractAI
      extended by games.strategy.triplea.strongAI.StrongAI
All Implemented Interfaces:
IGamePlayer, IRemote, ITripleaPlayer

public class StrongAI
extends AbstractAI
implements IGamePlayer, ITripleaPlayer


Field Summary
static Match<Unit> HasntMoved
           
static Match<Unit> Transporting
           
 
Constructor Summary
StrongAI(java.lang.String name)
          Creates new TripleAPlayer
 
Method Summary
protected  void battle(IBattleDelegate battleDelegate, GameData data, PlayerID player)
          It is the AI's turn to fight.
 boolean confirmMoveInFaceOfAA(java.util.Collection aaFiringTerritories)
          The attempted move will incur aa fire, confirm that you still want to move
 java.util.Collection<Unit> getNumberOfFightersToMoveToNewCarrier(java.util.Collection<Unit> fightersThatCanBeMoved, Territory from)
          get the fighters to move to a newly produced carrier
protected  void move(boolean nonCombat, IMoveDelegate moveDel, GameData data, PlayerID player)
          It is the AI's turn to move.
protected  void place(boolean bid, IAbstractPlaceDelegate placeDelegate, GameData data, PlayerID player)
          It is the AI's turn to place units.
protected  void purchase(boolean purcahseForBid, int PUsToSpend, IPurchaseDelegate purchaseDelegate, GameData data, PlayerID player)
          It is the AI's turn to purchase units.
 Territory retreatQuery(GUID battleID, boolean submerge, java.util.Collection<Territory> possibleTerritories, java.lang.String message)
          Ask the player if he wishes to retreat.
 boolean selectAttackSubs(Territory unitTerritory)
          Ask if the player wants to attack lone subs
 boolean selectAttackTransports(Territory territory)
          Ask if the player wants to attack lone transports
 boolean selectAttackUnits(Territory unitTerritory)
          Ask if the player wants to attack units
 Territory selectBombardingTerritory(Unit unit, Territory unitTerritory, java.util.Collection<Territory> territories, boolean noneAvailable)
          Select the territory to bombard with the bombarding capable unit (eg battleship)
 CasualtyDetails selectCasualties(java.util.Collection<Unit> selectFrom, java.util.Map<Unit,java.util.Collection<Unit>> dependents, int count, java.lang.String message, DiceRoll dice, PlayerID hit, java.util.List<Unit> defaultCasualties, GUID battleID)
          Select casualties
 int[] selectFixedDice(int numRolls, int hitAt, boolean hitOnlyIfEquals, java.lang.String message)
          Select a fixed dice roll
 Territory selectTerritoryForAirToLand(java.util.Collection candidates)
          Some carriers were lost while defending.
 boolean shouldBomberBomb(Territory territory)
          One or more bombers have just moved into a territory where a strategic bombing raid can be conducted, should the bomber bomb?
protected  void tech(ITechDelegate techDelegate, GameData data, PlayerID player)
          It is the AI's turn to roll for technology.
 
Methods inherited from class games.strategy.triplea.baseAI.AbstractAI
battleInfoMessage, confirmEnemyCasualties, confirmMoveHariKari, confirmMoveKamikaze, confirmOwnCasualties, getGameData, getID, getName, getPlayerBridge, getRemotePlayerType, getWhoAmI, initialize, pause, reportError, reportMessage, retreatNotificationMessage, selectShoreBombard, start, whereShouldRocketsAttack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface games.strategy.engine.gamePlayer.IGamePlayer
getID, getName, initialize, start
 
Methods inherited from interface games.strategy.triplea.player.ITripleaPlayer
confirmEnemyCasualties, confirmMoveHariKari, confirmMoveKamikaze, confirmOwnCasualties, getID, reportError, reportMessage, selectShoreBombard, whereShouldRocketsAttack
 

Field Detail

HasntMoved

public static final Match<Unit> HasntMoved

Transporting

public static final Match<Unit> Transporting
Constructor Detail

StrongAI

public StrongAI(java.lang.String name)
Creates new TripleAPlayer

Method Detail

tech

protected void tech(ITechDelegate techDelegate,
                    GameData data,
                    PlayerID player)
Description copied from class: AbstractAI
It is the AI's turn to roll for technology.

Specified by:
tech in class AbstractAI
Parameters:
techDelegate - - the tech delegate to roll for
data - - the game data
player - - the player to roll tech for

move

protected void move(boolean nonCombat,
                    IMoveDelegate moveDel,
                    GameData data,
                    PlayerID player)
Description copied from class: AbstractAI
It is the AI's turn to move. Make all moves before returning from this method.

Specified by:
move in class AbstractAI
Parameters:
nonCombat - - are we moving in combat, or non combat
moveDel - - the move delegate to make moves with
data - - the current game data
player - - the player to move with

battle

protected void battle(IBattleDelegate battleDelegate,
                      GameData data,
                      PlayerID player)
Description copied from class: AbstractAI
It is the AI's turn to fight. Subclasses may override this if they want, but generally the AI does not need to worry about the order of fighting battles.

Overrides:
battle in class AbstractAI
Parameters:
battleDelegate - the battle delegate to query for battles not fought and the
data - - the current GameData
player - - the player to fight for

purchase

protected void purchase(boolean purcahseForBid,
                        int PUsToSpend,
                        IPurchaseDelegate purchaseDelegate,
                        GameData data,
                        PlayerID player)
Description copied from class: AbstractAI
It is the AI's turn to purchase units.

Specified by:
purchase in class AbstractAI
Parameters:
purcahseForBid - - is this a bid purchase, or a normal purchase
PUsToSpend - - how many PUs we have to spend
purchaseDelegate - - the purchase delgate to buy things with
data - - the GameData
player - - the player to buy for

place

protected void place(boolean bid,
                     IAbstractPlaceDelegate placeDelegate,
                     GameData data,
                     PlayerID player)
Description copied from class: AbstractAI
It is the AI's turn to place units. get the units available to place with player.getUnits()

Specified by:
place in class AbstractAI
Parameters:
bid - - is this a placement for bid
placeDelegate - - the place delegate to place with
data - - the current Game Data
player - - the player to place for

selectCasualties

public CasualtyDetails selectCasualties(java.util.Collection<Unit> selectFrom,
                                        java.util.Map<Unit,java.util.Collection<Unit>> dependents,
                                        int count,
                                        java.lang.String message,
                                        DiceRoll dice,
                                        PlayerID hit,
                                        java.util.List<Unit> defaultCasualties,
                                        GUID battleID)
Description copied from interface: ITripleaPlayer
Select casualties

Specified by:
selectCasualties in interface ITripleaPlayer
Parameters:
selectFrom - - the units to select casualties from
dependents - - dependents of the units to select from
count - - the number of casualties to select
message - - ui message to display
dice - - the dice rolled for the casualties
hit - - the player hit
defaultCasualties - - default casualties as selected by the game
battleID - - the battle we are fighting in, may be null if this is an aa casualty selection during a move
Returns:
the selected casualties Added new collection autoKilled to handle killing units prior to casualty selection

shouldBomberBomb

public boolean shouldBomberBomb(Territory territory)
Description copied from interface: ITripleaPlayer
One or more bombers have just moved into a territory where a strategic bombing raid can be conducted, should the bomber bomb?

Specified by:
shouldBomberBomb in interface ITripleaPlayer

selectAttackSubs

public boolean selectAttackSubs(Territory unitTerritory)
Description copied from interface: ITripleaPlayer
Ask if the player wants to attack lone subs

Specified by:
selectAttackSubs in interface ITripleaPlayer
Overrides:
selectAttackSubs in class AbstractAI
Parameters:
unitTerritory - - where the potential battle is

selectAttackUnits

public boolean selectAttackUnits(Territory unitTerritory)
Description copied from interface: ITripleaPlayer
Ask if the player wants to attack units

Specified by:
selectAttackUnits in interface ITripleaPlayer
Overrides:
selectAttackUnits in class AbstractAI
Parameters:
unitTerritory - - where the potential battle is

selectAttackTransports

public boolean selectAttackTransports(Territory territory)
Description copied from interface: ITripleaPlayer
Ask if the player wants to attack lone transports

Specified by:
selectAttackTransports in interface ITripleaPlayer
Overrides:
selectAttackTransports in class AbstractAI
Parameters:
territory - - where the potential battle is

getNumberOfFightersToMoveToNewCarrier

public java.util.Collection<Unit> getNumberOfFightersToMoveToNewCarrier(java.util.Collection<Unit> fightersThatCanBeMoved,
                                                                        Territory from)
Description copied from interface: ITripleaPlayer
get the fighters to move to a newly produced carrier

Specified by:
getNumberOfFightersToMoveToNewCarrier in interface ITripleaPlayer
Parameters:
fightersThatCanBeMoved - - the fighters that can be moved
from - - the territory containing the factory
Returns:
- the fighters to move

selectTerritoryForAirToLand

public Territory selectTerritoryForAirToLand(java.util.Collection candidates)
Description copied from interface: ITripleaPlayer
Some carriers were lost while defending. We must select where to land some air units.

Specified by:
selectTerritoryForAirToLand in interface ITripleaPlayer
Parameters:
candidates - - a list of territories - these are the places where air units can land
Returns:
- the territory to land the fighters in, must be non null

confirmMoveInFaceOfAA

public boolean confirmMoveInFaceOfAA(java.util.Collection aaFiringTerritories)
Description copied from interface: ITripleaPlayer
The attempted move will incur aa fire, confirm that you still want to move

Specified by:
confirmMoveInFaceOfAA in interface ITripleaPlayer
Parameters:
aaFiringTerritories - - the territories where aa will fire

selectBombardingTerritory

public Territory selectBombardingTerritory(Unit unit,
                                           Territory unitTerritory,
                                           java.util.Collection<Territory> territories,
                                           boolean noneAvailable)
Select the territory to bombard with the bombarding capable unit (eg battleship)

Specified by:
selectBombardingTerritory in interface ITripleaPlayer
Overrides:
selectBombardingTerritory in class AbstractAI
Parameters:
unit - - the bombarding unit
unitTerritory - - where the bombarding unit is
territories - - territories where the unit can bombard
noneAvailable -
Returns:
the Territory to bombard in, null if the unit should not bombard

retreatQuery

public Territory retreatQuery(GUID battleID,
                              boolean submerge,
                              java.util.Collection<Territory> possibleTerritories,
                              java.lang.String message)
Description copied from interface: ITripleaPlayer
Ask the player if he wishes to retreat.

Specified by:
retreatQuery in interface ITripleaPlayer
Parameters:
battleID - - the battle
submerge - - is submerging possible
possibleTerritories - - where the player can retreat to
message - - user displayable message
Returns:
the territory to retreat to, or null if the player doesnt wish to retreat

selectFixedDice

public int[] selectFixedDice(int numRolls,
                             int hitAt,
                             boolean hitOnlyIfEquals,
                             java.lang.String message)
Description copied from interface: ITripleaPlayer
Select a fixed dice roll

Specified by:
selectFixedDice in interface ITripleaPlayer
Parameters:
numRolls - - the number of dice rolls
hitAt - - the lowest roll that constitutes a hit (0 for none)
hitOnlyIfEquals - - whether to count rolls greater than hitAt as hits
message - - the title for the DiceChooser
Returns:
the resulting dice array