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 classclassprivate classprivate class(package private) classNested classes/interfaces inherited from class SimpleAI
SimpleAI.PowerSkill, SimpleAI.TriggerTimeIsUpNested classes/interfaces inherited from class 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 doubleprivate static final Logger(package private) static final int(package private) static final int(package private) static final int(package private) final intFields inherited from class SimpleAI
MIN_ITERATIONS, timeIsUp, timeLimitFields inherited from class AbstractAI
bec, client, cvc, hintSectionUsed, random, variant -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) RationalAI.MusteredCreatureschooseCreaturesToSplitOut(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 notbooleanchoose whether legion should concede to enemy(package private) RationalAI.BattleResultsestimateBattleResults(Legion attacker, Legion defender, MasterHex hex) private RationalAI.BattleResultsestimateBattleResults(Legion attacker, Legion defender, MasterHex hex, CreatureType callable) private intevaluateCombat(Legion attacker, Legion defender, MasterHex hex) private intevaluateHexAttack(Legion attacker, MasterHex hex, int canRecruitHere) private intevaluateMove(Legion legion, MasterHex hex, int canRecruitHere, int depth, boolean addHexRisk) Memoizing wrapper for evaluateMoveInnerprivate intevaluateMoveInner(Legion legion, MasterHex hex, int canRecruitHere, int depth, boolean normalHexRisk) private doubleexpectedValueSplitLegion(LegionClientSide legion, LegionClientSide child_legion) private booleanfindMoveList(List<? extends Legion> legions, List<List<RationalAI.LegionBoardMove>> all_legionMoves, MultiSet<MasterHex> occupiedHexes, boolean teleportsOnly) private booleanReturn true if done with all splits and callbacksbooleanchoose whether legion should flee from enemygetCombatList(Legion legion, MasterBoardTerrain terrain, boolean defender) private booleanhandleForcedSingleMove(Player player) private booleanhandleForcedSplitMoves(Player player) private booleanhandleVoluntaryMoves(Player player) Return true if we moved something and need to be called again.private doublebooleanReturn 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 doubler3(double value) private doublerecruitValue(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) booleansplit()make splits for current player.booleansplitCallback(Legion parent, Legion child) If parentId and childId are null, this is a callback to an undo split(package private) booleansplitOneLegion(Player player, Legion legion) Return true if done, false if waiting for callback.private booleansplitOneLegionCallback(LegionClientSide parent, LegionClientSide child) Return true if done, false if waiting for undo splitMethods inherited from class 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, summonAngelMethods inherited from class 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
-
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:
splitCallbackin interfaceAI- Overrides:
splitCallbackin classSimpleAI
-
expectedValueSplitLegion
-
splitOneLegion
-
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:
masterMovein interfaceAI- Overrides:
masterMovein classSimpleAI
-
findMoveList
-
handleVoluntaryMoves
Return true if we moved something and need to be called again. -
handleForcedSplitMoves
-
handleForcedSingleMove
-
hexRisk
-
evaluateCombat
-
evaluateHexAttack
-
evaluateMove
-
evaluateMoveInner
-
estimateBattleResults
-
estimateBattleResults
private RationalAI.BattleResults estimateBattleResults(Legion attacker, Legion defender, MasterHex hex, CreatureType callable) -
flee
-
concede
-
getCombatList
public List<SimpleAI.PowerSkill> getCombatList(Legion legion, MasterBoardTerrain terrain, boolean defender)
-