vacworld
Class VacAgent

java.lang.Object
  extended byagent.Agent
      extended byvacworld.VacAgent

public class VacAgent
extends Agent


Constructor Summary
VacAgent()
           
 
Method Summary
 boolean adjacentTo(int x1, int y1, int x2, int y2)
           
 int distance(int x1, int y1, int x2, int y2)
          Return the Manhattan distance between two squares.
 void fillCheck(int ox, int oy)
          After discovering a new obstacle, check to see if any squares become unreachable, so that they may be marked as obstacle as well.
 int getMaxUnknownColY(int[][] map, int dx)
           
 int getMaxUnknownRowX(int[][] map, int dy)
           
 int getMaxUnknownX(int[][] map)
           
 int getMaxUnknownY(int[][] map)
           
 int getMinUnknownColY(int[][] map, int dx)
           
 int getMinUnknownRowX(int[][] map, int dy)
           
 int getMinUnknownX(int[][] map)
           
 int getMinUnknownY(int[][] map)
           
 boolean obstacleToLeft()
           
 void printAgentMap()
           
 void see(Percept p)
          Provide a Percept to the agent.
 Action selectAction()
          Have the agent select its next action to perform.
 boolean unreachable(int x, int y)
          Can the given square be reached.
 void updateDesSquare()
          Based on the agent's desired heading (as determined by it's point in a spiral path) and its knowledge of the world, update which square the agent next wants to explore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VacAgent

public VacAgent()
Method Detail

see

public void see(Percept p)
Description copied from class: Agent
Provide a Percept to the agent. This function is called by the environment at the beginning of each of the agent's turn. If the agent has internal state, this method should also update it.

Specified by:
see in class Agent

selectAction

public Action selectAction()
Description copied from class: Agent
Have the agent select its next action to perform. Implements the action: Per -> Ac function or the action: I -> Ac function, depending on whether or not the agent has internal state.

Specified by:
selectAction in class Agent

fillCheck

public void fillCheck(int ox,
                      int oy)
After discovering a new obstacle, check to see if any squares become unreachable, so that they may be marked as obstacle as well.


unreachable

public boolean unreachable(int x,
                           int y)
Can the given square be reached. That is, is it surrounded by walls?


distance

public int distance(int x1,
                    int y1,
                    int x2,
                    int y2)
Return the Manhattan distance between two squares.


updateDesSquare

public void updateDesSquare()
Based on the agent's desired heading (as determined by it's point in a spiral path) and its knowledge of the world, update which square the agent next wants to explore.


getMinUnknownY

public int getMinUnknownY(int[][] map)

getMinUnknownX

public int getMinUnknownX(int[][] map)

getMaxUnknownY

public int getMaxUnknownY(int[][] map)

getMaxUnknownX

public int getMaxUnknownX(int[][] map)

getMinUnknownRowX

public int getMinUnknownRowX(int[][] map,
                             int dy)

getMaxUnknownRowX

public int getMaxUnknownRowX(int[][] map,
                             int dy)

getMinUnknownColY

public int getMinUnknownColY(int[][] map,
                             int dx)

getMaxUnknownColY

public int getMaxUnknownColY(int[][] map,
                             int dx)

adjacentTo

public boolean adjacentTo(int x1,
                          int y1,
                          int x2,
                          int y2)

obstacleToLeft

public boolean obstacleToLeft()

printAgentMap

public void printAgentMap()