|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.columbia.cs.coms4701.agent.environments.simple.AbstractEnvironment<RobotAction,RobotPercept,RobotAgent>
edu.columbia.cs.coms4701.agent.environments.robot.RoombaEnvironment
public class RoombaEnvironment
The environment in which a robo-vac agent lives, spends its days, and dies.
Field Summary |
---|
Fields inherited from class edu.columbia.cs.coms4701.agent.environments.simple.AbstractEnvironment |
---|
agents, counter, environmentObjects, environmentObservers |
Constructor Summary | |
---|---|
RoombaEnvironment(int timeAllowed,
GridMap theMap)
Constructs a new RoombaEnvironment from the given GridMap. |
|
RoombaEnvironment(int timeAllowed,
int height,
int width)
Constructs a new RoombaEnvironment that will be of the given height and width. |
Method Summary | |
---|---|
void |
addAgent(RobotAgent theAgent)
Extended to initialize robot performance measures. |
void |
addEnvironmentObject(EnvironmentObject theObject)
Extended to note the addition of the first GridMap. |
void |
agentDrivenChange(RobotAgent theAgent,
RobotAction theAction)
Changes the state of zero or more environment objects, given an agent and the action that the agent selected. |
void |
dynamicChange()
Extended to calculate the performance measure in each clock tick. |
GridMap |
getMap()
Fetches the first GridMap that was added to the environment. |
void |
initialSetup()
Does the initial setup of the Roomba environment. |
boolean |
isDone()
Halts the environment after the allotted time has passed. |
java.util.Set<RobotPercept> |
perceptsForAgent(RobotAgent theAgent)
Returns a set of percepts for the given agent. |
static GridMap |
readMapFromStream(java.io.InputStream theStream)
Convenience function which constructs a GridMap by parsing a simple text format. |
Methods inherited from class edu.columbia.cs.coms4701.agent.environments.simple.AbstractEnvironment |
---|
addEnvironmentObserver, executeStep, getAgents, getCounter, getEnvironmentObjects, run |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface edu.columbia.cs.coms4701.agent.Environment |
---|
addEnvironmentObserver, executeStep, getAgents, getCounter, getEnvironmentObjects, run |
Constructor Detail |
---|
public RoombaEnvironment(int timeAllowed, int height, int width)
Note that the environment's GridMap is not actually constructed until #initialSetup is invoked. This permits observers to be attached first.
timeAllowed
- the number of steps the robot is allowed to run before halting the environmentheight
- width
- public RoombaEnvironment(int timeAllowed, GridMap theMap)
timeAllowed
- the number of steps the robot is allowed to run before halting the environmenttheMap
- a GridMap containing RoombaDirt and GridObstaclesMethod Detail |
---|
public static GridMap readMapFromStream(java.io.InputStream theStream)
The text of the stream must contain:
java.lang.RuntimeException
- if the stream cannot be parsedpublic boolean isDone()
isDone
in interface Environment<RobotAction,RobotPercept,RobotAgent>
isDone
in class AbstractEnvironment<RobotAction,RobotPercept,RobotAgent>
public void initialSetup()
initialSetup
in interface Environment<RobotAction,RobotPercept,RobotAgent>
initialSetup
in class AbstractEnvironment<RobotAction,RobotPercept,RobotAgent>
public void dynamicChange()
dynamicChange
in interface Environment<RobotAction,RobotPercept,RobotAgent>
dynamicChange
in class AbstractEnvironment<RobotAction,RobotPercept,RobotAgent>
public java.util.Set<RobotPercept> perceptsForAgent(RobotAgent theAgent)
In the RoombaEnvironment, an agent's first set of precepts will include:
perceptsForAgent
in interface Environment<RobotAction,RobotPercept,RobotAgent>
perceptsForAgent
in class AbstractEnvironment<RobotAction,RobotPercept,RobotAgent>
public void agentDrivenChange(RobotAgent theAgent, RobotAction theAction)
agentDrivenChange
in interface Environment<RobotAction,RobotPercept,RobotAgent>
agentDrivenChange
in class AbstractEnvironment<RobotAction,RobotPercept,RobotAgent>
theAgent
- the agent that just selected an actiontheAction
- the action selectedpublic void addEnvironmentObject(EnvironmentObject theObject)
addEnvironmentObject
in interface Environment<RobotAction,RobotPercept,RobotAgent>
addEnvironmentObject
in class AbstractEnvironment<RobotAction,RobotPercept,RobotAgent>
theObject
- the EnvironmentObject to addpublic void addAgent(RobotAgent theAgent)
addAgent
in interface Environment<RobotAction,RobotPercept,RobotAgent>
addAgent
in class AbstractEnvironment<RobotAction,RobotPercept,RobotAgent>
public GridMap getMap()
getMap
in interface GridEnvironment<RobotAction,RobotPercept,RobotAgent>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |