Package net.sf.colossus.ai
Class RationalAI
java.lang.Object
net.sf.colossus.ai.AbstractAI
net.sf.colossus.ai.SimpleAI
net.sf.colossus.ai.RationalAI
- All Implemented Interfaces:
AI
- Direct Known Subclasses:
HumanHaterRationalAI
,MilvangAI
Simple implementation of a Titan AI
- Author:
- Bruce Sherrod, David Ripton, Romain Dolbeau, Corwin Joy, extensively rewritten on 02-Oct-2003
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
class
private class
private class
(package private) class
Nested classes/interfaces inherited from class net.sf.colossus.ai.SimpleAI
SimpleAI.PowerSkill, SimpleAI.TriggerTimeIsUp
Nested classes/interfaces inherited from class net.sf.colossus.ai.AbstractAI
AbstractAI.AbstractAIOracle, AbstractAI.CreatureValueConstants, AbstractAI.MoveInfo
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<RationalAI.LegionBoardMove>
private Iterator<RationalAI.LegionBoardMove>
(package private) boolean
(package private) final double
private static final Logger
(package private) static final int
(package private) static final int
(package private) static final int
(package private) final int
Fields inherited from class net.sf.colossus.ai.SimpleAI
MIN_ITERATIONS, timeIsUp, timeLimit
Fields inherited from class net.sf.colossus.ai.AbstractAI
bec, client, cvc, hintSectionUsed, random, variant
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) RationalAI.MusteredCreatures
chooseCreaturesToSplitOut
(Legion legion, boolean at_risk) Decide how to split this legion, and return a list of Creatures to remove + status flag indicating if these creatures have mustered or notboolean
choose whether legion should concede to enemy(package private) RationalAI.BattleResults
estimateBattleResults
(Legion attacker, Legion defender, MasterHex hex) private RationalAI.BattleResults
estimateBattleResults
(Legion attacker, Legion defender, MasterHex hex, CreatureType callable) private int
evaluateCombat
(Legion attacker, Legion defender, MasterHex hex) private int
evaluateHexAttack
(Legion attacker, MasterHex hex, int canRecruitHere) private int
evaluateMove
(Legion legion, MasterHex hex, int canRecruitHere, int depth, boolean addHexRisk) Memoizing wrapper for evaluateMoveInnerprivate int
evaluateMoveInner
(Legion legion, MasterHex hex, int canRecruitHere, int depth, boolean normalHexRisk) private double
expectedValueSplitLegion
(LegionClientSide legion, LegionClientSide child_legion) private boolean
findMoveList
(List<? extends Legion> legions, List<List<RationalAI.LegionBoardMove>> all_legionMoves, MultiSet<MasterHex> occupiedHexes, boolean teleportsOnly) private boolean
Return true if done with all splits and callbacksboolean
choose whether legion should flee from enemygetCombatList
(Legion legion, MasterBoardTerrain terrain, boolean defender) private boolean
handleForcedSingleMove
(Player player) private boolean
handleForcedSplitMoves
(Player player) private boolean
handleVoluntaryMoves
(Player player) Return true if we moved something and need to be called again.private double
boolean
Return true if we need to run this method again after the server updates the client with the results of a move or mulligan.private static double
r3
(double value) private double
recruitValue
(Legion legion, MasterHex hex, Legion enemy, MasterBoardTerrain terrain) Find value of recruiting, including possibly attacking an enemy set enemy = null to indicate no enemyprivate List<CreatureType>
removeMustered
(List<CreatureType> sortedCreatures) private List<CreatureType>
sortCreaturesByValueName
(Legion legion) boolean
split()
make splits for current player.boolean
splitCallback
(Legion parent, Legion child) If parentId and childId are null, this is a callback to an undo split(package private) boolean
splitOneLegion
(Player player, Legion legion) Return true if done, false if waiting for callback.private boolean
splitOneLegionCallback
(LegionClientSide parent, LegionClientSide child) Return true if done, false if waiting for undo splitMethods inherited from class net.sf.colossus.ai.SimpleAI
acquireAngel, battleMove, chooseRecruit, doInitialGameSplit, evaluateCritterMove_Defender, evaluateCritterMove_Rangestrike, evaluateCritterMove_Strike, evaluateCritterMove_Titan, evaluateLegionBattleMove, evaluateLegionBattleMoveAsAWhole, findBestLegionMove, findLegionMoves, findWeakestTwoCritters, getCreatureMoveLimit, getNativeValue, handleCarries, handleMulligans, muster, pickColor, pickEngagement, pickEntrySide, pickMarker, pickStrikePenalty, RATIO_DRAW, RATIO_LOSE_HEAVY_LOSS, RATIO_WIN_HEAVY_LOSS, RATIO_WIN_MINIMAL_LOSS, reinforce, retryFailedBattleMoves, setupTimer, strike, summonAngel
Methods inherited from class net.sf.colossus.ai.AbstractAI
buildEnemyAttackMap, cleanupBattle, couldRecruitUp, countCreatureAccrossAllLegionFromPlayer, findStrikeMap, generateDamageMap, generateLegionMoves, getAcqStepValue, getBattleStrike, getBattleUnit, getCaretaker, getHintedRecruitmentValue, getHintedRecruitmentValueNonTitan, getHintedRecruitmentValueNonTitan, getInitialSplitHint, getKillValue, getKillValue, getNumberOfWaysToTerrain, getVariantRecruitHint, hasOpponentNativeCreature, initBattle, isHumanLegion, makeLegionMove, rangeToClosestOpponent, setVariant
-
Field Details
-
logger
-
I_HATE_HUMANS
boolean I_HATE_HUMANS -
legionsToSplit
-
enemyAttackMap
-
evaluateMoveMap
-
bestMoveList
-
bestMoveListIter
-
TITAN_SURVIVAL
final int TITAN_SURVIVAL- See Also:
-
RECRUIT_FALSE
static final int RECRUIT_FALSE- See Also:
-
RECRUIT_TRUE
static final int RECRUIT_TRUE- See Also:
-
RECRUIT_AT_7
static final int RECRUIT_AT_7- See Also:
-
KILLPOINTS
final double KILLPOINTS- See Also:
-
-
Constructor Details
-
RationalAI
-
-
Method Details
-
r3
private static double r3(double value) -
split
public boolean split()Description copied from interface:AI
make splits for current player. Return true if done -
fireSplits
private boolean fireSplits()Return true if done with all splits and callbacks -
splitCallback
If parentId and childId are null, this is a callback to an undo split- Specified by:
splitCallback
in interfaceAI
- Overrides:
splitCallback
in classSimpleAI
-
expectedValueSplitLegion
-
splitOneLegion
Return true if done, false if waiting for callback. -
splitOneLegionCallback
Return true if done, false if waiting for undo split -
recruitValue
Find value of recruiting, including possibly attacking an enemy set enemy = null to indicate no enemy -
removeMustered
-
sortCreaturesByValueName
-
chooseCreaturesToSplitOut
Decide how to split this legion, and return a list of Creatures to remove + status flag indicating if these creatures have mustered or not -
masterMove
public boolean masterMove()Return true if we need to run this method again after the server updates the client with the results of a move or mulligan.- Specified by:
masterMove
in interfaceAI
- Overrides:
masterMove
in classSimpleAI
-
findMoveList
-
handleVoluntaryMoves
Return true if we moved something and need to be called again. -
handleForcedSplitMoves
-
handleForcedSingleMove
-
hexRisk
-
evaluateCombat
-
evaluateHexAttack
-
evaluateMove
private int evaluateMove(Legion legion, MasterHex hex, int canRecruitHere, int depth, boolean addHexRisk) Memoizing wrapper for evaluateMoveInner -
evaluateMoveInner
-
estimateBattleResults
-
estimateBattleResults
private RationalAI.BattleResults estimateBattleResults(Legion attacker, Legion defender, MasterHex hex, CreatureType callable) -
flee
Description copied from interface:AI
choose whether legion should flee from enemy -
concede
Description copied from interface:AI
choose whether legion should concede to enemy -
getCombatList
public List<SimpleAI.PowerSkill> getCombatList(Legion legion, MasterBoardTerrain terrain, boolean defender)
-