Package b2p.model

Interface IState

  • All Known Implementing Classes:
    BitSetState

    public interface IState
    Interface defining the state of the game
    Author:
    Alessandro Buldini, Alessandro Pomponio, Federico Zanini
    • Field Detail

      • boardDimension

        static final int boardDimension
        The board is a 9x9 square
        See Also:
        Constant Field Values
    • Method Detail

      • getTurn

        it.unibo.ai.didattica.competition.tablut.domain.State.Turn getTurn()
        Accesses the private field turn
        Returns:
        the current turn
        See Also:
        State.Turn
      • setTurn

        void setTurn​(it.unibo.ai.didattica.competition.tablut.domain.State.Turn turn)
        Sets the private field turn value
        Parameters:
        turn - is a Turn data type
        See Also:
        State.Turn
      • getBlackPawns

        B2PBitSet getBlackPawns()
        Accesses the private field black pawns
        Returns:
        B2PBitSet containing black pawns
        See Also:
        B2PBitSet
      • getWhitePawns

        B2PBitSet getWhitePawns()
        Accesses the private field white pawns
        Returns:
        B2PBitSet containing white pawns
        See Also:
        B2PBitSet
      • getKing

        B2PBitSet getKing()
        Accesses the private field king
        Returns:
        B2PBitSet containing the king
        See Also:
        B2PBitSet
      • getBoard

        B2PBitSet getBoard()
        Accesses the private field board
        Returns:
        B2PBitSet containing the board
        See Also:
        B2PBitSet
      • isWinningState

        boolean isWinningState()
        Checks if the current state is a winning state
        Returns:
        True if it is a winning state
      • blackHasWon

        boolean blackHasWon()
        Checks if the black has won the game
        Returns:
        True if black has won
      • whiteHasWon

        boolean whiteHasWon()
        Checks if the white has won the game
        Returns:
        True if white has won
      • simulateMove

        IState simulateMove​(IAction action)
        Simulates a specified move from a given IAction
        Parameters:
        action - IAction representing the action to simulate
        Returns:
        A copy of the BitSetState after the move is performed
        See Also:
        IAction
      • performMove

        void performMove​(java.lang.String from,
                         java.lang.String to)
        Performs a given action using a specified BitSetPosition from and a specified BitSetPosition to
        Parameters:
        from - String representing the starting position
        to - String representing the final position
        See Also:
        BitSetPosition
      • performMove

        void performMove​(int from,
                         int to)
        Performs a given action using a specified from and a specified to
        Parameters:
        from - Integer representing the starting position
        to - Integer representing the final position
      • getAvailablePawnMoves

        java.util.List<IAction> getAvailablePawnMoves()
        Gets all the available moves for the pawns
        Returns:
        A List of possible actions
        See Also:
        IAction
      • getAvailableKingMoves

        java.util.List<IAction> getAvailableKingMoves()
        Gets all the available moves for the king
        Returns:
        A List of possible actions
        See Also:
        IAction
      • getHeuristicValue

        int getHeuristicValue()
        Returns the heuristic value for a player in the current turn
        Returns:
        the heuristic value for a player in the current turn
        See Also:
        State.Turn
      • getHeuristicValueForPlayer

        int getHeuristicValueForPlayer​(it.unibo.ai.didattica.competition.tablut.domain.State.Turn player)
        Returns the heuristic value for a given player in the current turn
        Parameters:
        player - is a Turn object
        Returns:
        the heuristic value for a given player in the current turn
        See Also:
        State.Turn