Package search.ab
Class Evaluation
java.lang.Object
search.ab.Evaluation
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic doublestatic doublestatic doublestatic doublestatic doublestatic double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LinkedList<Integer> convertMovesToList(LinkedHashMap<Integer, List<Integer>> moves) Converts a map of moves to a list for easier manipulation.static LinkedHashMap<Integer, List<Integer>> convertMovesToMap(List<Integer> movesList) Converts a list of moves (as combined integers) back to a map representation.static doubleComputes the score (contribution) of a piece based on its type and weight.static doublegetScoreWrapper(MoveGenerator moveGenerator, Color player, double depth) Computes the score of the current game position for a specified player.static doublegetScoreWrapperAI(MoveGenerator moveGenerator, Color player, double depth, LinkedHashMap<Integer, List<Integer>> moves) Computes the score of the current game position for a player considering opponent's moves.static doublegetScoreWrapperOld(MoveGenerator moveGenerator, Color player, String fen) Computes the score of the current game position for a specified player in an old version for benchmarking.static voidorderMoves(LinkedList<Integer> moves, Color color, MoveGenerator game) Orders moves in a list based on whether a move winning, capturing, and closeness to target row.static voidorderMovesOld(LinkedList<Integer> moves, Color color) Orders moves in a list in an old version for benchmarking based on whether a move winning and closeness to target row.doublerateMove(MoveGenerator gameState, Color color, int startPosition, int endPosition, int depth) Rates a move in the game based on its impact on the game position for a specified player.static doubleratePosition(MoveGenerator moveGenerator, Color color, int depth) Rates the overall position of the game for a specified player.static doubleratePositionAI(MoveGenerator moveGenerator, Color color, int depth, LinkedHashMap<Integer, List<Integer>> moves, Color currentColor) Rates the overall position of the game for a player considering opponent's moves.static doubleratePositionOld(MoveGenerator moveGenerator, Color color, String fen) Rates the overall position of the game for a specified player in an old version for benchmarking.
-
Field Details
-
possibleMovesWeight
public static double possibleMovesWeight -
protectedPiecesWeight
public static double protectedPiecesWeight -
doubleWeight
public static double doubleWeight -
mixedWeight
public static double mixedWeight -
closenessWeight
public static double closenessWeight -
closenessWeightTotal
public static double closenessWeightTotal
-
-
Constructor Details
-
Evaluation
public Evaluation()
-
-
Method Details
-
getScore
Computes the score (contribution) of a piece based on its type and weight.- Parameters:
piece- The type of piece (SINGLE, DOUBLE, or MIXED).score- The current score to be updated.weight- The weight multiplier for the piece type.- Returns:
- The updated score after adding the piece's contribution.
-
getScoreWrapper
Computes the score of the current game position for a specified player.- Parameters:
moveGenerator- The MoveGenerator object providing game state information.player- The color of the player for whom the score is computed (BLUE or RED).depth- The current depth of evaluation in the search tree.- Returns:
- The computed score for the player in the current position.
-
getScoreWrapperAI
public static double getScoreWrapperAI(MoveGenerator moveGenerator, Color player, double depth, LinkedHashMap<Integer, List<Integer>> moves) Computes the score of the current game position for a player considering opponent's moves. Optimised for AI search- Parameters:
moveGenerator- The MoveGenerator object providing game state information.player- The color of the player for whom the score is computed (BLUE or RED).depth- The current depth of evaluation in the search tree.moves- The opponent's moves represented as a map of combined integer start and end positions.- Returns:
- The computed score for the player in the current position.
-
ratePosition
Rates the overall position of the game for a specified player.- Parameters:
moveGenerator- The MoveGenerator object providing game state information.color- The color of the player for whom the position is rated (BLUE or RED).depth- The current depth of evaluation in the search tree.- Returns:
- The rating of the current position for the specified player.
-
ratePositionAI
public static double ratePositionAI(MoveGenerator moveGenerator, Color color, int depth, LinkedHashMap<Integer, List<Integer>> moves, Color currentColor) Rates the overall position of the game for a player considering opponent's moves. Optimised for AI search- Parameters:
moveGenerator- The MoveGenerator object providing game state information.color- The color of the player for whom the position is rated (BLUE or RED).depth- The current depth of evaluation in the search tree.moves- The opponent's moves represented as a map of combined integer start and end positions.currentColor- The current color of the AI player.- Returns:
- The rating of the current position for the specified player.
-
getScoreWrapperOld
Computes the score of the current game position for a specified player in an old version for benchmarking.- Parameters:
moveGenerator- The MoveGenerator object providing game state information.player- The color of the player for whom the score is computed (BLUE or RED).fen- The FEN representation of the current board position.- Returns:
- The computed score for the player in the current position.
-
ratePositionOld
Rates the overall position of the game for a specified player in an old version for benchmarking.- Parameters:
moveGenerator- The MoveGenerator object providing game state information.color- The color of the player for whom the position is rated (BLUE or RED).fen- The FEN representation of the current board position.- Returns:
- The rating of the current position for the specified player.
-
rateMove
public double rateMove(MoveGenerator gameState, Color color, int startPosition, int endPosition, int depth) Rates a move in the game based on its impact on the game position for a specified player.- Parameters:
gameState- The current MoveGenerator object representing the game state.color- The color of the player making the move (BLUE or RED).startPosition- The combined integer starting position of the move.endPosition- The combined integer ending position of the move.depth- The current depth of evaluation in the search tree.- Returns:
- The computed score change due to the move.
-
convertMovesToList
Converts a map of moves to a list for easier manipulation.- Parameters:
moves- A map representing moves as combined integer start positions mapped to lists of end positions.- Returns:
- A map of moves where each move is represented as a combined integer.
-
convertMovesToMap
Converts a list of moves (as combined integers) back to a map representation.- Parameters:
movesList- A list of moves where each move is represented as a combined integer.- Returns:
- A map representing moves as combined integer start positions mapped to lists of end positions.
-
orderMoves
Orders moves in a list based on whether a move winning, capturing, and closeness to target row.- Parameters:
moves- A list of moves where each move is represented as a combined integer.color- The color of the player for whom moves are being ordered (BLUE or RED).game- The MoveGenerator object providing game state information.
-
orderMovesOld
Orders moves in a list in an old version for benchmarking based on whether a move winning and closeness to target row.- Parameters:
moves- A list of moves where each move is represented as a combined integer.color- The color of the player for whom moves are being ordered (BLUE or RED).
-