Package com.takenoko.engine
Class ActionManager
java.lang.Object
com.takenoko.engine.ActionManager
This class is used to manage the actions of a bot.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final List<Class<? extends DefaultAction>>private static final intprivate int -
Constructor Summary
ConstructorsConstructorDescriptionActionManager(int numberOfActions, List<Class<? extends Action>> availableActions) ActionManager(ActionManager actionManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd an action to the number of actions to plau this turnvoidaddAvailableAction(Class<? extends Action> action) add an action to the list of available actionsvoidaddAvailableActions(List<Class<? extends Action>> actions) add a list of actions to the list of available actionsprivate voidclear the list of available actions of the FORCED typebooleanget the list of already done actionsReturn the list of available actions.protected intinthashCode()voidreset()voidresetAvailableActions(Board board, BotState botState) reset the available actionsvoidsetNumberOfActions(int numberOfActions) Set the number of actions the bot can do in a turn.voidupdateAvailableActions(Action action, ActionResult actionResult) update an action in available actionsvoidupdateDefaultActions(Board board, BotState botState) update to the defaults actions
-
Field Details
-
DEFAULT_NUMBER_OF_ACTIONS
private static final int DEFAULT_NUMBER_OF_ACTIONS- See Also:
-
DEFAULT_AVAILABLE_ACTIONS
-
numberOfActions
private int numberOfActions -
availableActions
-
alreadyDoneActions
-
-
Constructor Details
-
ActionManager
public ActionManager() -
ActionManager
-
ActionManager
-
-
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
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
add an action to the list of available actions- Parameters:
action- the action to add
-
addAvailableActions
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
update an action in available actions- Parameters:
action- the action to updateactionResult- the result of the action
-
updateDefaultActions
update to the defaults actions- Parameters:
board- the board
-
resetAvailableActions
reset the available actions- Parameters:
board- the board
-
getAlreadyDoneActions
get the list of already done actions- Returns:
- the list of already done actions
-
reset
public void reset() -
equals
-
hashCode
public int hashCode()
-