Class ActionManager

java.lang.Object
com.takenoko.engine.ActionManager

public class ActionManager extends Object
This class is used to manage the actions of a bot.
  • Field Details

    • DEFAULT_NUMBER_OF_ACTIONS

      private static final int DEFAULT_NUMBER_OF_ACTIONS
      See Also:
    • DEFAULT_AVAILABLE_ACTIONS

      private static final List<Class<? extends DefaultAction>> DEFAULT_AVAILABLE_ACTIONS
    • numberOfActions

      private int numberOfActions
    • availableActions

      private List<Class<? extends Action>> availableActions
    • alreadyDoneActions

      private List<Class<? extends Action>> alreadyDoneActions
  • Constructor Details

    • ActionManager

      public ActionManager()
    • ActionManager

      public ActionManager(ActionManager actionManager)
    • ActionManager

      public ActionManager(int numberOfActions, List<Class<? extends Action>> availableActions)
  • Method Details

    • setNumberOfActions

      public void setNumberOfActions(int numberOfActions)
      Set the number of actions the bot can do in a turn.
      Parameters:
      numberOfActions -
    • getNumberOfActions

      protected int getNumberOfActions()
      Returns:
      number of actions the bot can do in a turn
    • getAvailableActions

      public List<Class<? extends Action>> getAvailableActions()
      Return the list of available actions. If actions of FORCED type are available, only these actions are returned else all available actions are returned.
      Returns:
      the list of available actions
    • addAvailableAction

      public void addAvailableAction(Class<? extends Action> action)
      add an action to the list of available actions
      Parameters:
      action - the action to add
    • addAvailableActions

      public void addAvailableActions(List<Class<? extends Action>> actions)
      add a list of actions to the list of available actions
      Parameters:
      actions - the list of actions to add
    • addAction

      public void addAction()
      add an action to the number of actions to plau this turn
    • clearForcedActions

      private void clearForcedActions()
      clear the list of available actions of the FORCED type
    • updateAvailableActions

      public void updateAvailableActions(Action action, ActionResult actionResult)
      update an action in available actions
      Parameters:
      action - the action to update
      actionResult - the result of the action
    • updateDefaultActions

      public void updateDefaultActions(Board board, BotState botState)
      update to the defaults actions
      Parameters:
      board - the board
    • resetAvailableActions

      public void resetAvailableActions(Board board, BotState botState)
      reset the available actions
      Parameters:
      board - the board
    • getAlreadyDoneActions

      public List<Class<? extends Action>> getAlreadyDoneActions()
      get the list of already done actions
      Returns:
      the list of already done actions
    • reset

      public void reset()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object