net.sf.colossus.ai
Class ParallelEvaluatorAI
java.lang.Object
net.sf.colossus.ai.AbstractAI
net.sf.colossus.ai.SimpleAI
net.sf.colossus.ai.ExperimentalAI
net.sf.colossus.ai.ParallelEvaluatorAI
- All Implemented Interfaces:
- AI
public class ParallelEvaluatorAI
- extends ExperimentalAI
DON'T USE THAT ONE YET.
This one implements a parallel findBestLegionMove. Unfortunately, SimpleAI
implementation of evaluateLegionBattleMove is anything but thread-safe, and
it goes very deep:
Evaluations functions mostly fall-back to asking the Client object property
of the current situation. So they have first to move all BattleCritter
(which are only a view of full BattleUnit) to the evaluated position, then
evaluate.
This version only tests the parallelism, so evaluateLegionBattleMove is
random.
We would need to
(1) implements Strike as BattleClientSide, a proper, per-battle extension of
Battle (the way it is done on with BattleServerSide)
(2) make sure all evaluate functions only use property of BattleClientSide,
even if that means changing the state of BattleClientSide.
(3) have a proper deep copy constructor in BattleClientSide, so we can work
on several variant at once.
- Author:
- Romain Dolbeau
Field Summary |
private static java.util.logging.Logger |
LOGGER
|
private static int |
NTHREADS
|
Methods inherited from class net.sf.colossus.ai.SimpleAI |
acquireAngel, chooseRecruit, concede, doInitialGameSplit, findWeakestTwoCritters, flee, getCreatureMoveLimit, getNativeValue, handleCarries, handleMulligans, masterMove, muster, pickColor, pickEngagement, pickEntrySide, pickMarker, pickStrikePenalty, RATIO_DRAW, RATIO_LOSE_HEAVY_LOSS, RATIO_WIN_HEAVY_LOSS, RATIO_WIN_MINIMAL_LOSS, reinforce, retryFailedBattleMoves, setupTimer, split, splitCallback, strike, summonAngel |
Methods inherited from class net.sf.colossus.ai.AbstractAI |
buildEnemyAttackMap, couldRecruitUp, countCreatureAccrossAllLegionFromPlayer, findStrikeMap, generateDamageMap, generateLegionMoves, getAcqStepValue, getBattleStrike, getBattleUnit, getCaretaker, getHintedRecruitmentValue, getHintedRecruitmentValueNonTitan, getHintedRecruitmentValueNonTitan, getInitialSplitHint, getKillValue, getKillValue, getNumberOfWaysToTerrain, getVariantRecruitHint, hasOpponentNativeCreature, isHumanLegion, makeLegionMove, rangeToClosestOpponent, setVariant |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOGGER
private static final java.util.logging.Logger LOGGER
NTHREADS
private static final int NTHREADS
- See Also:
- Constant Field Values
ParallelEvaluatorAI
public ParallelEvaluatorAI(Client client)
evaluateLegionBattleMove
protected int evaluateLegionBattleMove(LegionMove lm)
- Overrides:
evaluateLegionBattleMove
in class SimpleAI
findBestLegionMove
protected LegionMove findBestLegionMove(java.util.Collection<LegionMove> legionMoves)
- Description copied from class:
SimpleAI
- Evaluate all legion moves in the list, and return the best one.
Break out early if the time limit is exceeded.
- Overrides:
findBestLegionMove
in class SimpleAI