Package com.takenoko.engine
Class BotState
java.lang.Object
com.takenoko.engine.BotState
This class is used to store the state of a bot.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ActionManagerprivate final Inventorystatic final intprivate final ObjectiveManager -
Constructor Summary
ConstructorsConstructorDescriptionBotState()Copy constructorBotState(Inventory inventory, ObjectiveManager objectiveManager, 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 actionsvoidaddObjective(Objective objective) Set the current Objective of the botcopy()make a copy of the current statebooleanget the list of achieved objectivesget the list of already done actionsReturn the list of available actions.intReturn the bot inventoryprotected intGet the current Objectives of the botintget the score of the achieved objectivesintReturns the sum of the points of all the panda objectivesGet the list of the redeemed objectivesinthashCode()voidredeemObjective(Objective objective) redeem an objectivevoidreset()reset everything to the default valuesvoidresetAvailableActions(Board board) reset the available actionsvoidsetNumberOfActions(int numberOfActions) voidsetObjectiveAchieved(Objective objective) set an objective as achievedvoidsetObjectiveNotAchieved(Objective objective) set an objective as not achievedvoidsetStartingDeck(List<Objective> objectives) Set the starting deckvoidupdate the objectivesvoidupdateAvailableActions(Action action, ActionResult actionResult) update an action in available actionsvoidverifyObjectives(Board board) for each objective, check if it is achieved
-
Field Details
-
MAX_OBJECTIVES
public static final int MAX_OBJECTIVES- See Also:
-
objectiveManager
-
actionManager
-
inventory
-
-
Constructor Details
-
BotState
public BotState(Inventory inventory, ObjectiveManager objectiveManager, ActionManager actionManager) -
BotState
public BotState() -
BotState
Copy constructor- Parameters:
botState- the state to copy
-
-
Method Details
-
reset
public void reset()reset everything to the default values -
copy
make a copy of the current state- Returns:
- the copy
-
equals
-
hashCode
public int hashCode() -
update
update the objectives- Parameters:
board- the board
-
getEatenBambooCounter
public int getEatenBambooCounter()- Returns:
- the number of bamboo eaten by the bot
-
getInventory
Return the bot inventory- Returns:
- the bot inventory
-
setNumberOfActions
public void setNumberOfActions(int 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
-
addAction
public void addAction()add an action to the number of actions to plau this turn -
updateAvailableActions
update an action in available actions- Parameters:
action- the action to updateactionResult- the result of the action
-
resetAvailableActions
reset the available actions- Parameters:
board- the board
-
getAlreadyDoneActions
get the list of already done actions- Returns:
- the list of already done actions
-
getObjectives
Get the current Objectives of the bot- Returns:
- Objectives
-
addObjective
Set the current Objective of the bot- Parameters:
objective- the objectives
-
getObjectiveScore
public int getObjectiveScore()get the score of the achieved objectives- Returns:
- the score of the achieved objectives
-
getRedeemedObjectives
Get the list of the redeemed objectives- Returns:
- the list of the redeemed objectives
-
getAchievedObjectives
get the list of achieved objectives- Returns:
- the list of achieved objectives
-
verifyObjectives
for each objective, check if it is achieved- Parameters:
board- the board
-
setObjectiveNotAchieved
set an objective as not achieved- Parameters:
objective- the objective
-
setObjectiveAchieved
set an objective as achieved- Parameters:
objective- the objective
-
redeemObjective
redeem an objective- Parameters:
objective- the objective
-
getPandaObjectiveScore
public int getPandaObjectiveScore()Returns the sum of the points of all the panda objectives- Returns:
- the sum of the points of all the panda objectives
-
setStartingDeck
Set the starting deck- Parameters:
objectives- list of objectives
-
getNotAchievedObjectives
-