State¶
-
public class
State
implements Serializable, Cloneable, IDDistributer, DeepEquatable¶ Represents the state
Methods¶
addPlayer¶
-
public void
addPlayer
(int playernumber)¶ Add another player
Parameters: - playernumber – The player number of the player to add
addResource¶
-
public void
addResource
(ResourceNode resource)¶
addResourceAmount¶
-
public void
addResourceAmount
(int player, ResourceType type, int amount)¶ Adds an amount of a resource to a player’s global amount.
Parameters: - player –
- type –
- amount –
canSee¶
-
public boolean
canSee
(int x, int y, int player)¶ Returns whether the selected coordinates are visible to the player through the fog of war.
Parameters: - x –
- y –
- player –
checkValidSupplyAddition¶
-
public boolean
checkValidSupplyAddition
(int player, int amounttoadd, int offsettingcapgain)¶
deepEquals¶
getClosestPosition¶
-
public int[]
getClosestPosition
(int x, int y)¶ Find the closest unoccupied position using a spiraling out search pattern
Parameters: - x –
- y –
getNextTargetIDForXMLSave¶
-
public int
getNextTargetIDForXMLSave
()¶ DON’T USE THIS IF YOU AREN’T THE XML SAVING MECHANISM This must be different from the other so saves in the middle of an episode don’t mess up the ids
getNextTemplateIDForXMLSave¶
-
public int
getNextTemplateIDForXMLSave
()¶ DON’T USE THIS IF YOU AREN’T THE XML SAVING MECHANISM This must be different from the other so saves in the middle of an episode don’t mess up the ids
getPlayerState¶
-
public PlayerState
getPlayerState
(int player)¶
getPlayerStates¶
-
public Collection<PlayerState>
getPlayerStates
()¶
getResource¶
-
public ResourceNode
getResource
(int resourceId)¶
getResourceAmount¶
-
public int
getResourceAmount
(int player, ResourceType type)¶
getResources¶
-
public List<ResourceNode>
getResources
()¶
getStateCreator¶
-
public StateCreator
getStateCreator
()¶ Get a StateCreator that will duplicate what this state looks like when the function is called.
Throws: - IOException –
getTextString¶
incrementTurn¶
-
public void
incrementTurn
()¶ Go to the next turn. Increases the turn number and tells the logs to go to the next turn
moveUnit¶
recalculateVision¶
-
public void
recalculateVision
()¶ Recalculates the vision of each agent from scratch.
resourceAt¶
-
public ResourceNode
resourceAt
(int x, int y)¶