Class TablutGame

  • All Implemented Interfaces:
    IGame

    public class TablutGame
    extends java.lang.Object
    implements IGame
    This class implements IGame for Tablut
    Author:
    Alessandro Buldini, Alessandro Pomponio, Federico Zanini
    See Also:
    Aima Java
    • Constructor Summary

      Constructors 
      Constructor Description
      TablutGame​(IState state)
      Creates a TablutGame given an IState
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<IAction> getActions​(IState state)
      Returns all the possible actions a player can do at this stage of the game
      it.unibo.ai.didattica.competition.tablut.domain.State.Turn getPlayer​(IState state)
      Defines which player has to play at this stage of the game
      IState getResult​(IState state, IAction action)
      Returns the state of the game after performing the input action
      int getUtility​(IState state, it.unibo.ai.didattica.competition.tablut.domain.State.Turn turn)
      Returns the heuristic value for the given state and player
      boolean isTerminal​(IState state)
      Returns a boolean whether the current state is a terminal one
      void setState​(IState state)
      Sets the private variable state to the given value
      • Methods inherited from class java.lang.Object

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

      • TablutGame

        public TablutGame​(IState state)
        Creates a TablutGame given an IState
        Parameters:
        state - state of the game
    • Method Detail

      • setState

        public void setState​(IState state)
        Sets the private variable state to the given value
        Parameters:
        state - value that needs to be set
      • getPlayer

        public it.unibo.ai.didattica.competition.tablut.domain.State.Turn getPlayer​(IState state)
        Defines which player has to play at this stage of the game
        Specified by:
        getPlayer in interface IGame
        Parameters:
        state - represents the current state of the game
        Returns:
        the player who has to move
        See Also:
        IState
      • getActions

        public java.util.List<IAction> getActions​(IState state)
        Returns all the possible actions a player can do at this stage of the game
        Specified by:
        getActions in interface IGame
        Parameters:
        state - represents the current state of the game
        Returns:
        a list containing all possible actions
        See Also:
        IState
      • getResult

        public IState getResult​(IState state,
                                IAction action)
        Returns the state of the game after performing the input action
        Specified by:
        getResult in interface IGame
        Parameters:
        state - current state of the game
        action - action to perform
        Returns:
        IState after the move has been performed
        See Also:
        IState, IAction
      • isTerminal

        public boolean isTerminal​(IState state)
        Returns a boolean whether the current state is a terminal one
        Specified by:
        isTerminal in interface IGame
        Parameters:
        state - IState to be evaluated
        Returns:
        true if the current state is a terminal one
        See Also:
        IState
      • getUtility

        public int getUtility​(IState state,
                              it.unibo.ai.didattica.competition.tablut.domain.State.Turn turn)
        Returns the heuristic value for the given state and player
        Specified by:
        getUtility in interface IGame
        Parameters:
        state - state of the game that needs to be evaluated
        turn - player for which the heuristic function should be evaluated
        Returns:
        the heuristic value of the input state
        See Also:
        IState, State.Turn