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 ActionManager
private final Inventory
static final int
private final ObjectiveManager
-
Constructor Summary
ConstructorsConstructorDescriptionBotState()
Copy constructorBotState
(Inventory inventory, ObjectiveManager objectiveManager, ActionManager actionManager) -
Method Summary
Modifier and TypeMethodDescriptionvoid
add an action to the number of actions to plau this turnvoid
addAvailableAction
(Class<? extends Action> action) add an action to the list of available actionsvoid
addObjective
(Objective objective) Set the current Objective of the botcopy()
make a copy of the current stateboolean
get the list of achieved objectivesget the list of already done actionsReturn the list of available actions.int
Return the bot inventoryprotected int
Get the current Objectives of the botint
get the score of the achieved objectivesint
Returns the sum of the points of all the panda objectivesGet the list of the redeemed objectivesint
hashCode()
void
redeemObjective
(Objective objective) redeem an objectivevoid
reset()
reset everything to the default valuesvoid
resetAvailableActions
(Board board) reset the available actionsvoid
setNumberOfActions
(int numberOfActions) void
setObjectiveAchieved
(Objective objective) set an objective as achievedvoid
setObjectiveNotAchieved
(Objective objective) set an objective as not achievedvoid
setStartingDeck
(List<Objective> objectives) Set the starting deckvoid
update the objectivesvoid
updateAvailableActions
(Action action, ActionResult actionResult) update an action in available actionsvoid
verifyObjectives
(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
-