net.sf.colossus.ai
Class RationalAI.MoveFinder

java.lang.Object
  extended by net.sf.colossus.ai.RationalAI.MoveFinder
Enclosing class:
RationalAI

private class RationalAI.MoveFinder
extends java.lang.Object


Field Summary
private  java.util.List<RationalAI.LegionBoardMove> bestMove
           
private  double bestScore
           
private static double INITIAL_SCORE
           
private  boolean mustMove
           
private static double NO_MOVE_EXISTS
           
private  long nodesExplored
           
 
Constructor Summary
private RationalAI.MoveFinder()
           
 
Method Summary
private  void branchAndBound(java.util.List<RationalAI.LegionBoardMove> performedMoves, java.util.List<java.util.List<RationalAI.LegionBoardMove>> availableMoves, double currentValue)
           
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.
 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  double moveValueBound(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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
Constructor Detail

RationalAI.MoveFinder

private RationalAI.MoveFinder()
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)