pacworld
Class PacPercept

java.lang.Object
  extended by agent.Percept
      extended by pacworld.PacPercept

public class PacPercept
extends Percept

A percept in the package delivery world.


Constructor Summary
PacPercept(PackageState state, Agent agent)
          Construct a package delivery world percept.
 
Method Summary
 boolean feelBump()
          Returns true if the percept reflects that the agent bumped into an obstacle as a result of its most recent action.
 VisiblePackage getHeldPackage()
          Returns the visible package that the agent is currently holding.
 java.lang.String[] getMessages()
          Returns an array of strings representing messages sent since the agent's last turn.
 VisibleAgent[] getVisAgents()
          Returns an array of the visible agents.
 VisiblePackage[] getVisPackages()
          Return an array of the visible packages.
 int getWorldSize()
          Returns the length of the world.
 void printPercept()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PacPercept

public PacPercept(PackageState state,
                  Agent agent)
Construct a package delivery world percept. The agents can see everything in 9x9 grid centered on it. If the agent moved into an obstacle on the previous turn the agent will feel a bump.

Method Detail

feelBump

public boolean feelBump()
Returns true if the percept reflects that the agent bumped into an obstacle as a result of its most recent action.


getHeldPackage

public VisiblePackage getHeldPackage()
Returns the visible package that the agent is currently holding. If the agent is not holding a package, returns null. Note, since the agent can see all packages in the 9x9 square centered on itself, this package is also returned by getVisPackages().

Returns:

getMessages

public java.lang.String[] getMessages()
Returns an array of strings representing messages sent since the agent's last turn. There are only as many elements as messages sent, and there is no identification of which agent sent which message.


getVisAgents

public VisibleAgent[] getVisAgents()
Returns an array of the visible agents. Each element is of type VisibleAgent.


getVisPackages

public VisiblePackage[] getVisPackages()
Return an array of the visible packages. Each element is of type VisiblePackage. Only packages that have not been delivered will appear.


getWorldSize

public int getWorldSize()
Returns the length of the world. Note, the world is a square, so this also doubles as its height.


printPercept

public void printPercept()