|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.columbia.cs.coms4701.agent.environments.robot.RoombaAction
public class RoombaAction
Represents available actions for a RoombaAgent.
The nine possible actions are available as static fields, named
NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, NORTHWEST
and STOP
.
For your convenience, an additional field ACTIONS contains an array of the eight ordinary actions, to make it easier to iterate over the possibilities.
You may also specify an action by using the public constructor, e.g. calling new RoombaAction(0,-1) to go south.
Each action can be inspected by the #getVector() method, which specifies the x- and y-delta (via GeometricVector#getComponent(X_DIM) etc.)
Field Summary | |
---|---|
static RobotAction[] |
ACTIONS
|
static RobotAction |
EAST
|
static RobotAction |
NORTH
|
static RobotAction |
NORTHEAST
|
static RobotAction |
NORTHWEST
|
static RobotAction |
SOUTH
|
static RobotAction |
SOUTHEAST
|
static RobotAction |
SOUTHWEST
|
static RobotAction |
STOP
|
static RobotAction |
WEST
|
Constructor Summary | |
---|---|
RoombaAction(int x,
int y)
Creates a new RoombaAction for a move with the specified x- and y- delta. |
Method Summary | |
---|---|
DiscreteVector |
getVector()
Returns the 2-D vector specifying the chosen motion. |
boolean |
shouldStop()
Indicates whether the robot wants to stop. |
java.lang.String |
toString()
AgentActions should override toString() to provide a reasonable short description. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final RobotAction NORTH
public static final RobotAction NORTHEAST
public static final RobotAction EAST
public static final RobotAction SOUTHEAST
public static final RobotAction SOUTH
public static final RobotAction SOUTHWEST
public static final RobotAction WEST
public static final RobotAction NORTHWEST
public static final RobotAction STOP
public static final RobotAction[] ACTIONS
Constructor Detail |
---|
public RoombaAction(int x, int y)
For example, to go north, call new RoombaAction(0,1).
x
- direction delta (-1,0, or 1)y
- direction delta (-1,0, or 1)Method Detail |
---|
public java.lang.String toString()
AgentAction
toString
in interface AgentAction
toString
in class java.lang.Object
public DiscreteVector getVector()
getVector
in interface RobotAction
public boolean shouldStop()
shouldStop
in interface RobotAction
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |