Class BitSetMove


  • public class BitSetMove
    extends java.lang.Object
    BitSetMove Class provides methods for pieces' moves on the board as well as some functions used in the heuristics
    Author:
    Alessandro Buldini, Alessandro Pomponio, Federico Zanini
    • Constructor Summary

      Constructors 
      Constructor Description
      BitSetMove()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int blackPawnsOutOfCamps​(IState state)
      Returns an heuristic value depending on how many black pawns are out of camps
      static int dangerToKing​(IState state)
      Returns an heuristic value depending on how many black pawns endangering the king
      static int diagonalBlackCouples​(IState state)
      Returns an heuristic value depending on how many black pawns are in a diagonal position near to each other
      static int findTargetQuadrantForWhites​(BitSetState state)
      Returns an heuristic value depending on which is the best quadrant to target for the white player
      static B2PBitSet getCapturedPawns​(int from, int to, IState state)
      Returns a B2PBitSet which has set at 1 all captured pawns
      static java.util.List<IAction> getMovesForPawn​(int pawnPosition, IState state)
      Returns a list of possible moves for a given pawn position and a given game state
      static int kingEscapesInOneMove​(IState state)
      Returns a value depending on how many escapes the king has in a given state of the game
      static boolean kingHasMoreThanOneEscapePath​(IState state)
      Returns a Boolean value depending on whether the king has more than one escape path in a given state of the game
      static int kingMoves​(IState state)
      Returns an heuristic value depending on how many moves does the king have
      static int kingStatus​(IState state)
      Returns an heuristic value depending on how many white and black pawns are near the king whether the king is in the throne, outside the throne or near the throne
      static int movesNeededForKingEscape​(IState state)
      Returns an heuristic value depending on how many moves the king needs to perform in order to escape
      static int positionWeights​(IState state)
      Returns an heuristic value considering the weight of every position in the board
      static int whiteCellInStrategicPosition​(IState state)
      Returns an heuristic value depending on how many white pawns are in a strategic position
      static int whitePawnsAdjacentKing​(IState state)
      Returns an heuristic value depending on how many white pawns are adjacent to king
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BitSetMove

        public BitSetMove()
    • Method Detail

      • getMovesForPawn

        public static java.util.List<IAction> getMovesForPawn​(int pawnPosition,
                                                              IState state)
        Returns a list of possible moves for a given pawn position and a given game state
        Parameters:
        pawnPosition - position of the pawn
        state - current state of the game
        Returns:
        A List of possible moves
        See Also:
        IState
      • getCapturedPawns

        public static B2PBitSet getCapturedPawns​(int from,
                                                 int to,
                                                 IState state)
        Returns a B2PBitSet which has set at 1 all captured pawns
        Parameters:
        from - the position of the pawn starting cell
        to - the position of the pawn final cell
        state - the current state of the game
        Returns:
        a B2PBitSet which has set at 1 all captured pawns
        See Also:
        B2PBitSet
      • kingEscapesInOneMove

        public static int kingEscapesInOneMove​(IState state)
        Returns a value depending on how many escapes the king has in a given state of the game
        Parameters:
        state - the current state of the game
        Returns:
        an Integer representing an heuristic value
        See Also:
        BitSetPosition
      • kingHasMoreThanOneEscapePath

        public static boolean kingHasMoreThanOneEscapePath​(IState state)
        Returns a Boolean value depending on whether the king has more than one escape path in a given state of the game
        Parameters:
        state - the current state of the game
        Returns:
        true if the king has more than one escape path
        See Also:
        BitSetPosition
      • positionWeights

        public static int positionWeights​(IState state)
        Returns an heuristic value considering the weight of every position in the board
        Parameters:
        state - the current state of the game
        Returns:
        an heuristic value
        See Also:
        B2PBitSet
      • whiteCellInStrategicPosition

        public static int whiteCellInStrategicPosition​(IState state)
        Returns an heuristic value depending on how many white pawns are in a strategic position
        Parameters:
        state - the current state of the game
        Returns:
        an heuristic value
        See Also:
        whiteEarlyGameStrategicCells
      • kingStatus

        public static int kingStatus​(IState state)
        Returns an heuristic value depending on how many white and black pawns are near the king whether the king is in the throne, outside the throne or near the throne
        Parameters:
        state - the current state of the game
        Returns:
        an heuristic value
        See Also:
        B2PBitSet
      • kingMoves

        public static int kingMoves​(IState state)
        Returns an heuristic value depending on how many moves does the king have
        Parameters:
        state - the current state of the game
        Returns:
        an heuristic value
        See Also:
        getAvailableKingMoves
      • blackPawnsOutOfCamps

        public static int blackPawnsOutOfCamps​(IState state)
        Returns an heuristic value depending on how many black pawns are out of camps
        Parameters:
        state - the current state of the game
        Returns:
        an heuristic value
        See Also:
        IState, camps
      • diagonalBlackCouples

        public static int diagonalBlackCouples​(IState state)
        Returns an heuristic value depending on how many black pawns are in a diagonal position near to each other
        Parameters:
        state - the current state of the game
        Returns:
        an heuristic value
        See Also:
        IState, B2PBitSet
      • whitePawnsAdjacentKing

        public static int whitePawnsAdjacentKing​(IState state)
        Returns an heuristic value depending on how many white pawns are adjacent to king
        Parameters:
        state - the current state of the game
        Returns:
        an heuristic value
        See Also:
        IState, B2PBitSet
      • dangerToKing

        public static int dangerToKing​(IState state)
        Returns an heuristic value depending on how many black pawns endangering the king
        Parameters:
        state - the current state of the game
        Returns:
        an heuristic value
        See Also:
        IState, B2PBitSet, castle, specialKingCells
      • movesNeededForKingEscape

        public static int movesNeededForKingEscape​(IState state)
        Returns an heuristic value depending on how many moves the king needs to perform in order to escape
        Parameters:
        state - the current state of the game
        Returns:
        an heuristic value
        See Also:
        IState, movesNeededForKingEscape_rec
      • findTargetQuadrantForWhites

        public static int findTargetQuadrantForWhites​(BitSetState state)
        Returns an heuristic value depending on which is the best quadrant to target for the white player
        Parameters:
        state - the current state of the game
        Returns:
        an heuristic value
        See Also:
        BitSetState, BitSetStartingBoard