Inheritance diagram for blockworld.Env:

Public Member Functions | |
| Agent | addAgent (String name) |
| Add agent to the world. | |
| void | removeAgent (Agent agent) |
| Called by the interpreter when the agent this instance refers to is about to be removed from the platform. | |
| Agent | removeAgent (String name) |
| boolean | enter (Agent agent, final Point position, long timeout) |
| enter the environment via some entrance. | |
| boolean | addStone (Point position) throws IndexOutOfBoundsException |
| set stone at position | |
| boolean | removeStone (Point position) |
| remove stone at position | |
| boolean | setAgentPosition (Agent agent, Point position, long timeout) |
| boolean | doAgentNorth (Agent a, long timeout) |
| Move up. | |
| boolean | doAgentEast (Agent a, long timeout) |
| Move up. | |
| boolean | doAgentSouth (Agent a, long timeout) |
| Move down. | |
| boolean | doAgentWest (Agent a, long timeout) |
| Move left. | |
| boolean | doAgentPickup (Agent agent) |
| Attempt to take bomb from agent's current location. | |
| boolean | doAgentDrop (Agent agent) |
| Attempt to drop bomb at agent's current location. | |
| Agent | senseAgent (Point p) |
| Check for agent at coordinate. | |
| void | onAdd (int index, Object o) |
| void | onRemove (int index, Object o) |
| void | clear () |
| void | save (OutputStream destination) throws IOException |
| void | load (InputStream source) throws IOException, ClassNotFoundException |
| void | addAgentListener (ObsVectListener o) |
| This listener is notified upon changes regarding the Agent list. | |
| void | addStonesListener (ObsVectListener o) |
| This listener is notified upon changes regarding the Stones list. | |
| void | addBombsListener (ObsVectListener o) |
| This listener is notified upon changes regarding the Bombs list. | |
| Collection | agents () |
| void | setTrap (Point trap) |
| Set bomb trap location. | |
| Point | getTrap () |
| void | setSize (Dimension size) |
| resize world | |
| void | setSize (int width, int height) |
| helper function, calls setSize(Dimension) | |
| int | getWidth () |
| int | getHeight () |
| void | setSenseRange (int senserange) |
| int | getSenseRange () |
Public Attributes | |
| transient Signal | signalSenseRangeChanged = new Signal("env sense range changed") |
| emitted if sense range changed | |
| transient Signal | signalSizeChanged = new Signal("env size changed") |
| emitted if environment is resized | |
| transient Signal | signalTrapChanged = new Signal("env trap position changed") |
| emitted if bomb trap location changed | |
| transient Signal | signalEntranceChanged = new Signal("env entrance changed") |
| emitted if entrance position changed | |
| transient Signal | signalBombTrapped = new Signal("env bomb trapped") |
| emitted on collection of a bomb in the bomb trap | |
Protected Member Functions | |
| boolean | outOfBounds (Point p) |
| check if point is within environment boundaries | |
Protected Attributes | |
| ObsVect | _agents = new ObsVect(this) |
| list of agents (Agent) | |
| ObsVect | _stones = new ObsVect() |
| list of coordinates (Point) containing stones | |
| ObsVect | _bombs = new ObsVect() |
| list of coordinates (Point) containing bombs | |
| Dimension | _size = new Dimension(16,16) |
| size of environment | |
| Point | _trap = new Point(2,2) |
| location of bomb trap | |
| Point | _entrance = new Point(0,0) |
| location of entrance | |
| int | _senserange = 10 |
| number of cells visible to each agent | |
Package Functions | |
| boolean | addBomb (Point position) throws IndexOutOfBoundsException |
| drop bomb at specified position | |
| boolean | removeBomb (Point position) |
| attempt to remove bomb at specified position | |
| Collection | senseBombs (Point position) |
| Sense visible area for bombs. | |
| Collection | senseStones (Point position) |
| Sense visible area for stones. | |
| Collection | senseAgents (Point position) |
| Sense visible area for agents. This does not include self. | |
| boolean | senseBomb (Point p) |
| see if there is a stone at the specified coordinate | |
| boolean | senseStone (Point p) |
| see if there is a stone at the specified coordinate | |
main storage for agents and bombs, stones etc.
|
|
Add agent to the world. It will be put in a queue of agents waiting to enter the environment.
|
|
|
This listener is notified upon changes regarding the Agent list. Please note that this only involves registering new agents or removing existing agents. To track agent position changes, add a listener to that specific agent.
|
|
|
drop bomb at specified position
|
|
|
Attempt to drop bomb at agent's current location.
|
|
||||||||||||
|
Move up. The X component represents the horizontal position of the agent, with (0,0) being the top left position. Moving right thus means x = x + 1.
|
|
||||||||||||
|
Move up. The Y component represents the vertical position of the agent, with (0,0) being the top left position. So moving up means y = y - 1.
|
|
|
Attempt to take bomb from agent's current location.
|
|
||||||||||||
|
Move down.
|
|
||||||||||||
|
Move left.
|
|
||||||||||||||||
|
enter the environment via some entrance. This method will wait (block) infinitely until the entrance is free if the timeout argument is ommitted or has value -1.
|
|
|
check if point is within environment boundaries
|
|
|
|
|
|
Called by the interpreter when the agent this instance refers to is about to be removed from the platform. This will remove the agent from the environment, it also removes all listeners.
|
|
|
attempt to remove bomb at specified position
|
|
|
Check for agent at coordinate.
|
|
||||||||||||||||
|
|
|
|
resize world
|
|
|
Set bomb trap location. Agents must dispose bombs here.
|
1.3.7