|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object agent.State vacworld.VacuumState
public class VacuumState
Represents a state in the vacuum world.
Field Summary | |
---|---|
static int |
CLEAR
Constant representing a clear location. |
static int |
DIRT
Constant representing a dirty location. |
static int |
WALL
Constant representing a location with an obstacle. |
Constructor Summary | |
---|---|
VacuumState(int[][] map)
Construct a new vacuum state given an array that specifies the map. |
Method Summary | |
---|---|
boolean |
bumped()
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 |
display(java.io.PrintStream output)
Print an output of the state to a print stream. |
int |
getAgentDir()
Return the agent's orientation. |
java.lang.String |
getAgentDirString()
Return a string the represents the agent's orientation. |
int |
getAgentX()
Return the agent's X position. |
int |
getAgentY()
Return the agent's Y position. |
static VacuumState |
getInitState()
Return the default initial state for the vacuum world. |
int |
getNumDirtyLocs()
Return the number of dirty locations in the state. |
static VacuumState |
getRandomState()
Return a random initial state for the vacuum world. |
static VacuumState |
getRandomState(int randSeed)
Return a random initial state for the vacuum world using a specific seed. |
boolean |
hasDirt(int x,
int y)
Return true if the specified location has dirt in it. |
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. |
boolean |
isRobotOff()
Return true if the robot is turned off in the state. |
void |
removeDirt(int x,
int y)
Remove dirt from the specified location. |
void |
setAgentDir(int dir)
Change the agent's orientation. |
void |
setAgentX(int x)
Change the agent's X position. |
void |
setAgentY(int y)
Change the agent's Y position. |
void |
setBump(boolean bump)
Set an indicator that the robot bumped into an obstacle during its previous move. |
void |
setRobotOff(boolean off)
Set an indicator that the robot has shut down in the state. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int CLEAR
public static final int DIRT
public static final int WALL
Constructor Detail |
---|
public VacuumState(int[][] map)
Method Detail |
---|
public boolean bumped()
public void display()
display
in class State
public void display(java.io.PrintStream output)
public int getAgentDir()
public java.lang.String getAgentDirString()
public int getAgentX()
public int getAgentY()
public static VacuumState getInitState()
public int getNumDirtyLocs()
public static VacuumState getRandomState()
public static VacuumState getRandomState(int randSeed)
public boolean hasDirt(int x, int y)
public boolean hasObstacle(int x, int y)
public boolean inBounds(int x, int y)
public boolean isRobotOff()
public void removeDirt(int x, int y)
public void setAgentDir(int dir)
public void setAgentX(int x)
public void setAgentY(int y)
public void setBump(boolean bump)
public void setRobotOff(boolean off)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |