|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgames.strategy.triplea.baseAI.AbstractAI
public abstract class AbstractAI
Base class for ais.
Control pausing with the AI pause menu option AI's should note that any data that is stored in the ai instance, will be lost when the game is restarted. We cannot save data with an AI, since the player may choose to restart the game with a different ai, or with a human player.
If an ai finds itself starting in the middle of a move phase, or the middle of a purchase phase, (as would happen if a player saved the game during the middle of an AI's move phase) it is acceptable for the ai to play badly for a turn, but the ai should recover, and play correctly when the next phase of the game starts.
| Constructor Summary | |
|---|---|
AbstractAI(java.lang.String name)
|
|
| Method Summary | |
|---|---|
protected void |
battle(IBattleDelegate battleDelegate,
GameData data,
PlayerID player)
It is the AI's turn to fight. |
void |
battleInfoMessage(java.lang.String shortMessage,
DiceRoll dice)
The following methods are more for the ui, and the ai will generally not care |
void |
confirmEnemyCasualties(GUID battleId,
java.lang.String message,
PlayerID hitPlayer)
Allows the user to pause and confirm enemy casualties |
boolean |
confirmMoveHariKari()
The attempted move will kill some units |
boolean |
confirmMoveKamikaze()
The attempted move will kill some air units |
void |
confirmOwnCasualties(GUID battleId,
java.lang.String message)
|
protected GameData |
getGameData()
Get the GameData for the game. |
PlayerID |
getID()
|
java.lang.String |
getName()
|
protected IPlayerBridge |
getPlayerBridge()
Get the IPlayerBridge for this game player. |
java.lang.Class<ITripleaPlayer> |
getRemotePlayerType()
|
protected PlayerID |
getWhoAmI()
What player are we playing. |
void |
initialize(IPlayerBridge bridge,
PlayerID id)
|
protected abstract void |
move(boolean nonCombat,
IMoveDelegate moveDel,
GameData data,
PlayerID player)
It is the AI's turn to move. |
protected void |
pause()
Pause the game to allow the human player to see what is going on. |
protected abstract void |
place(boolean placeForBid,
IAbstractPlaceDelegate placeDelegate,
GameData data,
PlayerID player)
It is the AI's turn to place units. |
protected abstract void |
purchase(boolean purcahseForBid,
int PUsToSpend,
IPurchaseDelegate purchaseDelegate,
GameData data,
PlayerID player)
It is the AI's turn to purchase units. |
void |
reportError(java.lang.String error)
Report an error to the user. |
void |
reportMessage(java.lang.String message)
report a message to the user |
void |
retreatNotificationMessage(java.util.Collection<Unit> units)
|
boolean |
selectAttackSubs(Territory unitTerritory)
Ask if the player wants to attack lone subs |
boolean |
selectAttackTransports(Territory unitTerritory)
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)
The following methods the AI may choose to implemenmt, but in general won't |
boolean |
selectShoreBombard(Territory unitTerritory)
Ask if the player wants to shore bombard |
void |
start(java.lang.String name)
The given phase has started. |
protected abstract void |
tech(ITechDelegate techDelegate,
GameData data,
PlayerID player)
It is the AI's turn to roll for technology. |
Territory |
whereShouldRocketsAttack(java.util.Collection<Territory> candidates,
Territory from)
Choose where my rockets should fire |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface games.strategy.triplea.player.ITripleaPlayer |
|---|
confirmMoveInFaceOfAA, getNumberOfFightersToMoveToNewCarrier, retreatQuery, selectCasualties, selectFixedDice, selectTerritoryForAirToLand, shouldBomberBomb |
| Constructor Detail |
|---|
public AbstractAI(java.lang.String name)
name - - the name of the player.| Method Detail |
|---|
protected void pause()
public final void initialize(IPlayerBridge bridge,
PlayerID id)
protected final GameData getGameData()
protected final IPlayerBridge getPlayerBridge()
protected final PlayerID getWhoAmI()
protected abstract void purchase(boolean purcahseForBid,
int PUsToSpend,
IPurchaseDelegate purchaseDelegate,
GameData data,
PlayerID player)
purcahseForBid - - is this a bid purchase, or a normal purchasePUsToSpend - - how many PUs we have to spendpurchaseDelegate - - the purchase delgate to buy things withdata - - the GameDataplayer - - the player to buy for
protected abstract void tech(ITechDelegate techDelegate,
GameData data,
PlayerID player)
techDelegate - - the tech delegate to roll fordata - - the game dataplayer - - the player to roll tech for
protected abstract void move(boolean nonCombat,
IMoveDelegate moveDel,
GameData data,
PlayerID player)
nonCombat - - are we moving in combat, or non combatmoveDel - - the move delegate to make moves withdata - - the current game dataplayer - - the player to move with
protected abstract void place(boolean placeForBid,
IAbstractPlaceDelegate placeDelegate,
GameData data,
PlayerID player)
placeForBid - - is this a placement for bidplaceDelegate - - the place delegate to place withdata - - the current Game Dataplayer - - the player to place for
protected void battle(IBattleDelegate battleDelegate,
GameData data,
PlayerID player)
battleDelegate - the battle delegate to query for battles not fought and thedata - - the current GameDataplayer - - the player to fight for
public Territory selectBombardingTerritory(Unit unit,
Territory unitTerritory,
java.util.Collection<Territory> territories,
boolean noneAvailable)
selectBombardingTerritory in interface ITripleaPlayerunit - - the bombarding unitunitTerritory - - where the bombarding unit isterritories - - territories where the unit can bombard
public boolean selectAttackSubs(Territory unitTerritory)
ITripleaPlayer
selectAttackSubs in interface ITripleaPlayerunitTerritory - - where the potential battle ispublic boolean selectAttackTransports(Territory unitTerritory)
ITripleaPlayer
selectAttackTransports in interface ITripleaPlayerunitTerritory - - where the potential battle ispublic boolean selectAttackUnits(Territory unitTerritory)
ITripleaPlayer
selectAttackUnits in interface ITripleaPlayerunitTerritory - - where the potential battle ispublic boolean selectShoreBombard(Territory unitTerritory)
ITripleaPlayer
selectShoreBombard in interface ITripleaPlayerunitTerritory - - where the potential battle is
public Territory whereShouldRocketsAttack(java.util.Collection<Territory> candidates,
Territory from)
ITripleaPlayer
whereShouldRocketsAttack in interface ITripleaPlayercandidates - - a collection of Territories, the possible territories to attackfrom - - where the rockets are launched from, null for WW2V1 rules
public boolean confirmMoveKamikaze()
ITripleaPlayer
confirmMoveKamikaze in interface ITripleaPlayerpublic boolean confirmMoveHariKari()
ITripleaPlayer
confirmMoveHariKari in interface ITripleaPlayer
public void battleInfoMessage(java.lang.String shortMessage,
DiceRoll dice)
public void confirmEnemyCasualties(GUID battleId,
java.lang.String message,
PlayerID hitPlayer)
ITripleaPlayer
confirmEnemyCasualties in interface ITripleaPlayerpublic void retreatNotificationMessage(java.util.Collection<Unit> units)
public void reportError(java.lang.String error)
ITripleaPlayer
reportError in interface ITripleaPlayerpublic void reportMessage(java.lang.String message)
ITripleaPlayer
reportMessage in interface ITripleaPlayer
public void confirmOwnCasualties(GUID battleId,
java.lang.String message)
confirmOwnCasualties in interface ITripleaPlayerpublic final void start(java.lang.String name)
public final java.lang.Class<ITripleaPlayer> getRemotePlayerType()
public final java.lang.String getName()
public final PlayerID getID()
getID in interface ITripleaPlayer
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||