public class PackageState extends State
Modifier and Type | Field and Description |
---|---|
protected java.util.HashMap<Agent,PacAgentRep> |
agentReps
Array containing state information for the agents.
|
protected Location[] |
destinations |
protected PacGUI |
gui |
protected int |
idleCount |
protected java.lang.Object[][] |
map
An array to that contains the locations of objects in the world.
|
protected int |
mapSize |
protected int |
messageCount |
protected int |
nonProductiveCount |
protected int |
numAgents |
protected int |
numDests |
protected int |
numPackages |
protected int |
origNumPackages |
protected int |
pacCount
The number of moves with a package in hand.
|
protected java.util.ArrayList<Package> |
packages |
protected long |
totalMessageLength |
protected int |
workCount
The number of actions not including idling.
|
Constructor and Description |
---|
PackageState()
Construct a new package state.
|
Modifier and Type | Method and Description |
---|---|
boolean |
bumped(Agent a)
Return true if the agent bumped into an obstacle on its previous
move.
|
void |
display()
Print an output of the state to the screen.
|
void |
dropPackage(Agent a,
int dropX,
int dropY) |
protected PacAgentRep |
getAgentRep(Agent a) |
java.util.Collection<PacAgentRep> |
getAgentReps() |
int |
getAgentX(Agent a)
Return the X location of the specified agent.
|
int |
getAgentY(Agent a)
Return the Y location of the specified agent.
|
Location[] |
getDestinations() |
int |
getIdleCount() |
static PackageState |
getInitState(java.util.List<Agent> agts,
int numPackages,
int numDests,
int mapSize)
Return a random initial state for the vacuum world.
|
static PackageState |
getInitState(long seed,
java.util.List<Agent> agts,
int numPackages,
int numDests,
int mapSize)
Use the given seed to generate a pseudo-random initial state for
the vacuum world.
|
java.lang.Object[][] |
getMap()
Returns the map.
|
int |
getMapSize() |
int |
getMessageCount() |
java.lang.String[] |
getMessages() |
int |
getNonProductiveCount() |
int |
getNumDestinations() |
int |
getNumPackages() |
java.lang.Object |
getObjectAt(int x,
int y)
Return the object located at the specified location.
|
int |
getOrigNumPackages() |
int |
getPacCount() |
Package |
getPackageHeldByAgent(Agent a)
Return the package (if any) held by the specified agent.
|
java.util.List<Package> |
getPackages() |
long |
getTotalMessageLength() |
int |
getWorkCount() |
boolean |
hasObstacle(int x,
int y)
Return true if the specified location has an obstacle in it.
|
boolean |
inBounds(int x,
int y)
Return true if the location is within bounds of the state's map.
|
void |
pickup(Agent a,
Package p)
Modify the state so that the agent is holding the selected package.
|
void |
printState() |
void |
repositionAgent(Agent a,
int newX,
int newY)
Change the agent's position.
|
void |
repositionPackage(Package p,
int newX,
int newY)
Change a package's position.
|
void |
setBump(Agent a,
boolean bump)
Set an indicator that the robot bumped into an obstacle
during its previous move.
|
void |
setGUI(PacGUI pg) |
void |
setIdleCount(int ic) |
void |
setMessage(Agent a,
java.lang.String s)
Set whatever message was said by the agent in its previous move.
|
void |
tallyNonProductiveWork()
Increments workCount and nonProductive count.
|
protected java.util.HashMap<Agent,PacAgentRep> agentReps
protected java.util.ArrayList<Package> packages
protected Location[] destinations
protected int numAgents
protected int numPackages
protected int origNumPackages
protected int mapSize
protected int numDests
protected int idleCount
protected int workCount
protected int pacCount
protected int messageCount
protected long totalMessageLength
protected int nonProductiveCount
protected PacGUI gui
protected java.lang.Object[][] map
public static PackageState getInitState(long seed, java.util.List<Agent> agts, int numPackages, int numDests, int mapSize)
public static PackageState getInitState(java.util.List<Agent> agts, int numPackages, int numDests, int mapSize)
public void printState()
protected PacAgentRep getAgentRep(Agent a)
public int getAgentX(Agent a)
public int getAgentY(Agent a)
public Package getPackageHeldByAgent(Agent a)
public void pickup(Agent a, Package p)
public void repositionAgent(Agent a, int newX, int newY)
public void repositionPackage(Package p, int newX, int newY)
public void setBump(Agent a, boolean bump)
public boolean hasObstacle(int x, int y)
public java.lang.Object getObjectAt(int x, int y)
public boolean bumped(Agent a)
public boolean inBounds(int x, int y)
public void dropPackage(Agent a, int dropX, int dropY)
public int getNumPackages()
public int getOrigNumPackages()
public int getMapSize()
public int getIdleCount()
public void setIdleCount(int ic)
public java.util.List<Package> getPackages()
public java.util.Collection<PacAgentRep> getAgentReps()
public java.lang.String[] getMessages()
public int getNumDestinations()
public Location[] getDestinations()
public int getWorkCount()
public int getPacCount()
public int getMessageCount()
public long getTotalMessageLength()
public int getNonProductiveCount()
public void setMessage(Agent a, java.lang.String s)
public void display()
public void setGUI(PacGUI pg)
public java.lang.Object[][] getMap()
public void tallyNonProductiveWork()