Package net.sf.colossus.ai
Class RationalAI.MoveFinder
java.lang.Object
net.sf.colossus.ai.RationalAI.MoveFinder
- Enclosing class:
- RationalAI
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<RationalAI.LegionBoardMove>
private double
private static final double
private boolean
private static final double
private long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
branchAndBound
(List<RationalAI.LegionBoardMove> performedMoves, List<List<RationalAI.LegionBoardMove>> availableMoves, double currentValue) private boolean
checkNewCycle
(MasterHex target, MasterHex from, List<RationalAI.LegionBoardMove> moves) checkes if there is a path from 'from' to target, using the moves in the list.findOptimalMove
(List<List<RationalAI.LegionBoardMove>> all_legionMoves, boolean mustMove) private List<RationalAI.LegionBoardMove>
getValidMove
(List<RationalAI.LegionBoardMove> performedMoves) checks if a move is valid, and if so returns the moves in an executeable sequence.private double
moveValueBound
(List<List<RationalAI.LegionBoardMove>> availableMoves) private List<List<RationalAI.LegionBoardMove>>
removeHeadAndConflicts
(List<List<RationalAI.LegionBoardMove>> availableMoves, RationalAI.LegionBoardMove lm)
-
Field Details
-
bestMove
-
bestScore
private double bestScore -
mustMove
private boolean mustMove -
nodesExplored
private long nodesExplored -
INITIAL_SCORE
private static final double INITIAL_SCORE- See Also:
-
NO_MOVE_EXISTS
private static final double NO_MOVE_EXISTS- See Also:
-
-
Constructor Details
-
MoveFinder
private MoveFinder()
-
-
Method Details
-
findOptimalMove
public List<RationalAI.LegionBoardMove> findOptimalMove(List<List<RationalAI.LegionBoardMove>> all_legionMoves, boolean mustMove) -
moveValueBound
-
getValidMove
private List<RationalAI.LegionBoardMove> getValidMove(List<RationalAI.LegionBoardMove> performedMoves) checks if a move is valid, and if so returns the moves in an executeable sequence. The legios not moving are not part of bestMove. Returns null if the move is not valid.- Parameters:
performedMoves
-- Returns:
-
branchAndBound
private void branchAndBound(List<RationalAI.LegionBoardMove> performedMoves, List<List<RationalAI.LegionBoardMove>> availableMoves, double currentValue) -
checkNewCycle
private boolean checkNewCycle(MasterHex target, MasterHex from, List<RationalAI.LegionBoardMove> moves) checkes if there is a path from 'from' to target, using the moves in the list. This is used to see if there are cycles in the moves, when you ad a move from 'target' to 'from'- Parameters:
target
-from
-moves
-- Returns:
-
removeHeadAndConflicts
private List<List<RationalAI.LegionBoardMove>> removeHeadAndConflicts(List<List<RationalAI.LegionBoardMove>> availableMoves, RationalAI.LegionBoardMove lm)
-