Package HAL.GridsAndAgents
Class AgentSQ1D<T extends AgentGrid1D>
- java.lang.Object
-
- HAL.GridsAndAgents.AgentBase<T>
-
- HAL.GridsAndAgents.AgentBaseSpatial<T>
-
- HAL.GridsAndAgents.Agent1DBase<T>
-
- HAL.GridsAndAgents.AgentSQ1D<T>
-
- Type Parameters:
T
- the extended AgentGrid2D class that the agents will live in Created by rafael on 11/18/16.
- All Implemented Interfaces:
java.io.Serializable
public class AgentSQ1D<T extends AgentGrid1D> extends Agent1DBase<T> implements java.io.Serializable
extend the AgentSQ2D class if you want agents that exist on a 2D discrete lattice with the possibility of stacking multiple agents on the same typeGrid square- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AgentSQ1D()
-
Method Summary
Modifier and Type Method Description int
Age()
returns the age of the agent, in ticks.void
Dispose()
deletes the agentvoid
MoveSafeSQ(int newX)
Moves the agent to the specified square, will apply wraparound if it is enabledvoid
MoveSafeSQ(int newX, Coords1DBool IsValidMove)
void
MoveSQ(int x)
Moves the agent to the specified squaredouble
Xpt()
gets the xDim coordinate of the agentint
Xsq()
gets the xDim coordinate of the square that the agent occupies-
Methods inherited from class HAL.GridsAndAgents.Agent1DBase
DispX, Dist, DistSquared, MapEmptyHood, MapHood, MapHood, MapI, MapOccupiedHood, MapXpt, MapXsq
-
Methods inherited from class HAL.GridsAndAgents.AgentBaseSpatial
Isq
-
Methods inherited from class HAL.GridsAndAgents.AgentBase
BirthTick, IsAlive, SetBirthTick
-
-
-
-
Method Detail
-
MoveSQ
public void MoveSQ(int x)
Moves the agent to the specified square- Specified by:
MoveSQ
in classAgentBaseSpatial<T extends AgentGrid1D>
-
MoveSafeSQ
public void MoveSafeSQ(int newX)
Moves the agent to the specified square, will apply wraparound if it is enabled
-
MoveSafeSQ
public void MoveSafeSQ(int newX, Coords1DBool IsValidMove)
-
Xsq
public int Xsq()
gets the xDim coordinate of the square that the agent occupies- Specified by:
Xsq
in classAgent1DBase<T extends AgentGrid1D>
-
Xpt
public double Xpt()
gets the xDim coordinate of the agent- Specified by:
Xpt
in classAgent1DBase<T extends AgentGrid1D>
-
Dispose
public void Dispose()
deletes the agent- Specified by:
Dispose
in classAgentBase<T extends AgentGrid1D>
-
Age
public int Age()
Description copied from class:AgentBase
returns the age of the agent, in ticks. Be sure to use IncTick on the AgentGrid appropriately for this function to work.- Specified by:
Age
in classAgentBase<T extends AgentGrid1D>
-
-