Package net.sf.colossus.ai
Class RationalAI.MoveFinder
- java.lang.Object
-
- net.sf.colossus.ai.RationalAI.MoveFinder
-
- Enclosing class:
- RationalAI
private class RationalAI.MoveFinder extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<RationalAI.LegionBoardMove>bestMoveprivate doublebestScoreprivate static doubleINITIAL_SCOREprivate booleanmustMoveprivate static doubleNO_MOVE_EXISTSprivate longnodesExplored
-
Constructor Summary
Constructors Modifier Constructor Description privateMoveFinder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidbranchAndBound(java.util.List<RationalAI.LegionBoardMove> performedMoves, java.util.List<java.util.List<RationalAI.LegionBoardMove>> availableMoves, double currentValue)private booleancheckNewCycle(MasterHex target, MasterHex from, java.util.List<RationalAI.LegionBoardMove> moves)checkes if there is a path from 'from' to target, using the moves in the list.java.util.List<RationalAI.LegionBoardMove>findOptimalMove(java.util.List<java.util.List<RationalAI.LegionBoardMove>> all_legionMoves, boolean mustMove)private java.util.List<RationalAI.LegionBoardMove>getValidMove(java.util.List<RationalAI.LegionBoardMove> performedMoves)checks if a move is valid, and if so returns the moves in an executeable sequence.private doublemoveValueBound(java.util.List<java.util.List<RationalAI.LegionBoardMove>> availableMoves)private java.util.List<java.util.List<RationalAI.LegionBoardMove>>removeHeadAndConflicts(java.util.List<java.util.List<RationalAI.LegionBoardMove>> availableMoves, RationalAI.LegionBoardMove lm)
-
-
-
Field Detail
-
bestMove
private java.util.List<RationalAI.LegionBoardMove> bestMove
-
bestScore
private double bestScore
-
mustMove
private boolean mustMove
-
nodesExplored
private long nodesExplored
-
INITIAL_SCORE
private static final double INITIAL_SCORE
- See Also:
- Constant Field Values
-
NO_MOVE_EXISTS
private static final double NO_MOVE_EXISTS
- See Also:
- Constant Field Values
-
-
Method Detail
-
findOptimalMove
public java.util.List<RationalAI.LegionBoardMove> findOptimalMove(java.util.List<java.util.List<RationalAI.LegionBoardMove>> all_legionMoves, boolean mustMove)
-
moveValueBound
private double moveValueBound(java.util.List<java.util.List<RationalAI.LegionBoardMove>> availableMoves)
-
getValidMove
private java.util.List<RationalAI.LegionBoardMove> getValidMove(java.util.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(java.util.List<RationalAI.LegionBoardMove> performedMoves, java.util.List<java.util.List<RationalAI.LegionBoardMove>> availableMoves, double currentValue)
-
checkNewCycle
private boolean checkNewCycle(MasterHex target, MasterHex from, java.util.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 java.util.List<java.util.List<RationalAI.LegionBoardMove>> removeHeadAndConflicts(java.util.List<java.util.List<RationalAI.LegionBoardMove>> availableMoves, RationalAI.LegionBoardMove lm)
-
-