public class VacuumState extends State
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
VacuumState(int[][] map)
Construct a new vacuum state given an array that specifies the map.
|
Modifier and Type | Method and Description |
---|---|
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.
|
static void |
fillUnreachableSquares(VacuumState state) |
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.
|
public static final int CLEAR
public static final int DIRT
public static final int WALL
public VacuumState(int[][] map)
public static VacuumState getInitState()
public static VacuumState getRandomState()
public static VacuumState getRandomState(int randSeed)
public static void fillUnreachableSquares(VacuumState state)
public int getAgentX()
public int getAgentY()
public int getAgentDir()
public java.lang.String getAgentDirString()
public void setAgentX(int x)
public void setAgentY(int y)
public void setAgentDir(int dir)
public void setRobotOff(boolean off)
public void setBump(boolean bump)
public void removeDirt(int x, int y)
public boolean hasDirt(int x, int y)
public boolean hasObstacle(int x, int y)
public boolean bumped()
public boolean inBounds(int x, int y)
public boolean isRobotOff()
public int getNumDirtyLocs()
public void display(java.io.PrintStream output)
public void display()