Class MoveComparator

java.lang.Object
jadex.bdi.puzzle.MoveComparator
All Implemented Interfaces:
Comparator<Move>

public class MoveComparator extends Object implements Comparator<Move>
Sort moves according to a strategy.
  • Field Details

    • STRATEGY_NONE

      public static final String STRATEGY_NONE
      No strategy: try moves in order of appearance.
      See Also:
    • STRATEGY_LONG

      public static final String STRATEGY_LONG
      The strategy preferring jump moves, but ignoring colors.
      See Also:
    • STRATEGY_SAME_LONG

      public static final String STRATEGY_SAME_LONG
      The strategy preferring jump moves of same color.
      See Also:
    • STRATEGY_ALTER_LONG

      public static final String STRATEGY_ALTER_LONG
      The strategy preferring jump moves of different colors.
      See Also:
    • board

      protected IBoard board
      The board (required for checking which piece is in a given position).
    • strategy

      protected String strategy
      The strategy.
  • Constructor Details

    • MoveComparator

      public MoveComparator(IBoard board, String strategy)
      Create a move comparator.
  • Method Details

    • compare

      public int compare(Move move1, Move move2)
      Compare two moves.
      Specified by:
      compare in interface Comparator<Move>
      Returns:
      A negative number when the first move should come before the second.