games.strategy.triplea.weakAI
Class WeakAI

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

public class WeakAI
extends AbstractAI
implements IGamePlayer, ITripleaPlayer


Field Summary
static Match<Unit> HasntMoved
           
static Match<Unit> Transporting
           
 
Constructor Summary
WeakAI(java.lang.String name)
          Creates new TripleAPlayer
 
Method Summary
 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.
static Match<Territory> passableChannel(GameData data, PlayerID player)
           
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.
 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
battle, battleInfoMessage, confirmEnemyCasualties, confirmMoveHariKari, confirmMoveKamikaze, confirmOwnCasualties, getGameData, getID, getName, getPlayerBridge, getRemotePlayerType, getWhoAmI, initialize, pause, reportError, reportMessage, retreatNotificationMessage, selectAttackSubs, selectAttackTransports, selectAttackUnits, selectBombardingTerritory, 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, selectAttackSubs, selectAttackTransports, selectAttackUnits, selectBombardingTerritory, selectShoreBombard, whereShouldRocketsAttack
 

Field Detail

HasntMoved

public static final Match<Unit> HasntMoved

Transporting

public static final Match<Unit> Transporting
Constructor Detail

WeakAI

public WeakAI(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

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

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

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

passableChannel

public static final Match<Territory> passableChannel(GameData data,
                                                     PlayerID player)