pacworld
Class Dropoff
java.lang.Object
agent.Action
pacworld.Dropoff
public class Dropoff
- extends Action
A package delivery agent action that causes the agent to drop a package
in the specified direction. If the space is not already occupied, the
package will be left there. Note, the agent does not need a clear
space to rotate the package to the desired direction.
Constructor Summary |
Dropoff(int d)
Construct a new Dropoff action. |
Method Summary |
State |
execute(Agent a,
State s)
Return the state that results from the agent moving in the given direction
in the given state. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Dropoff
public Dropoff(int d)
- Construct a new Dropoff action. The parameter should use one of the
predefined constants from pacworld.Direction.
- Parameters:
d
- - The direction to drop the Package in.
execute
public State execute(Agent a,
State s)
- Return the state that results from the agent moving in the given direction
in the given state. In order to avoid creating unnecessary objects, we
do not create a new state, but instead modify the old one. This
would have to change if the Environment needs to maintain a history
of states.
- Specified by:
execute
in class Action
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object