public class SimulationGrid
Modifier and Type | Method and Description |
---|---|
Agent |
getAgentAt(int xPos,
int yPos)
Find the agent, if any, at a position.
|
int |
height()
Find the height of this grid.
|
boolean |
isOccupied(int xPos,
int yPos)
Determine if a position is occupied by an agent.
|
boolean |
isOpen(int xPos,
int yPos)
Determine if a position is open to be occupied by an agent.
|
void |
setAgentAt(int xPos,
int yPos,
Agent agent)
Set the agent at a given position.
|
int |
width()
Find the width of this grid.
|
public int width()
public int height()
public boolean isOccupied(int xPos, int yPos)
xPos
- The x-position in which we're lookingyPos
- The y-position in which we're lookingpublic boolean isOpen(int xPos, int yPos)
xPos
- The x-position in which we're lookingyPos
- The y-position in which we're lookingpublic Agent getAgentAt(int xPos, int yPos)
xPos
- The x-position in which we're lookingyPos
- The y-position in which we're lookingpublic void setAgentAt(int xPos, int yPos, Agent agent)
xPos
- The x-position in which we're lookingyPos
- The y-position in which we're lookingagent
- The agent to place therexPos
and yPos
must be within the grid