Package HAL.GridsAndAgents
Class AgentSQ3D<T extends AgentGrid3D>
- java.lang.Object
-
- HAL.GridsAndAgents.AgentBase<T>
-
- HAL.GridsAndAgents.AgentBaseSpatial<T>
-
- HAL.GridsAndAgents.Agent3DBase<T>
-
- HAL.GridsAndAgents.AgentSQ3D<T>
-
- Type Parameters:
T- the extended AgentGrid3D class that the agents will live in Created by rafael on 11/18/16.
- All Implemented Interfaces:
java.io.Serializable
public class AgentSQ3D<T extends AgentGrid3D> extends Agent3DBase<T> implements java.io.Serializable
extend the AgentSQ3D class if you want agents that exist on a 3D discrete lattice with the possibility of stacking multiple agents on the same typeGrid square- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AgentSQ3D()
-
Method Summary
Modifier and Type Method Description intAge()returns the age of the agent, in ticks.voidDispose()deletes the agentvoidMoveSafeSQ(int newX, int newY, int newZ)Similar to the move functions, only it will automatically either apply wraparound, or prevent moving along a partiular axis if movement would cause the agent to go out of bounds.voidMoveSQ(int iNext)moves the agent to the middle of the square at the indices/index specifiedvoidMoveSQ(int x, int y, int z)Moves the agent to the specified coordinatesdoubleXpt()gets the xDim coordinate of the agentintXsq()gets the xDim coordinate of the square that the agent occupiesdoubleYpt()gets the yDim coordinate of the agentintYsq()gets the yDim coordinate of the square that the agent occupiesdoubleZpt()gets the z coordinate of the agentintZsq()gets the z coordinate of the square that the agent occupies-
Methods inherited from class HAL.GridsAndAgents.Agent3DBase
DispX, DispY, DispZ, Dist, DistSquared, MapEmptyHood, MapHood, MapHood, MapI, MapOccupiedHood, MapXpt, MapXsq, MapYpt, MapYsq, MapZpt, MapZsq
-
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, int y, int z)Moves the agent to the specified coordinates
-
Xsq
public int Xsq()
gets the xDim coordinate of the square that the agent occupies- Specified by:
Xsqin classAgent3DBase<T extends AgentGrid3D>
-
Ysq
public int Ysq()
gets the yDim coordinate of the square that the agent occupies- Specified by:
Ysqin classAgent3DBase<T extends AgentGrid3D>
-
Zsq
public int Zsq()
gets the z coordinate of the square that the agent occupies- Specified by:
Zsqin classAgent3DBase<T extends AgentGrid3D>
-
Xpt
public double Xpt()
gets the xDim coordinate of the agent- Specified by:
Xptin classAgent3DBase<T extends AgentGrid3D>
-
Ypt
public double Ypt()
gets the yDim coordinate of the agent- Specified by:
Yptin classAgent3DBase<T extends AgentGrid3D>
-
Zpt
public double Zpt()
gets the z coordinate of the agent- Specified by:
Zptin classAgent3DBase<T extends AgentGrid3D>
-
Dispose
public void Dispose()
deletes the agent- Specified by:
Disposein classAgentBase<T extends AgentGrid3D>
-
MoveSQ
public void MoveSQ(int iNext)
Description copied from class:AgentBaseSpatialmoves the agent to the middle of the square at the indices/index specified- Specified by:
MoveSQin classAgentBaseSpatial<T extends AgentGrid3D>
-
MoveSafeSQ
public void MoveSafeSQ(int newX, int newY, int newZ)Similar to the move functions, only it will automatically either apply wraparound, or prevent moving along a partiular axis if movement would cause the agent to go out of bounds.
-
Age
public int Age()
returns the age of the agent, in ticks. Be sure to use IncTick on the AgentGrid appropriately for this function to work.- Specified by:
Agein classAgentBase<T extends AgentGrid3D>
-
-