ó
ªÁWc           @   s†  d  Z  d d l m Z d d l m Z d d l m Z d d l Z d d l Z d d l Z d e f d „  ƒ  YZ d e f d	 „  ƒ  YZ	 d
 e j
 f d „  ƒ  YZ d e	 f d „  ƒ  YZ d e	 f d „  ƒ  YZ i  d „ Z i  d „ Z d e j
 f d „  ƒ  YZ d „  Z d e	 f d „  ƒ  YZ d d! d „  ƒ  YZ d e	 f d „  ƒ  YZ d „  Z d e	 f d „  ƒ  YZ d e f d „  ƒ  YZ d  „  Z d S("   s¬  
This file contains all of the agents that can be selected to control Pacman.  To
select an agent, use the '-p' option when running pacman.py.  Arguments can be
passed to your agent using '-a'.  For example, to load a SearchAgent that uses
depth first search (dfs), run the following command:

> python pacman.py -p SearchAgent -a fn=depthFirstSearch

Commands to invoke other search strategies can be found in the project
description.

Please only change the parts of the file you are asked to.  Look for the lines
that say

"*** YOUR CODE HERE ***"

The parts you fill in start about 3/4 of the way down.  Follow the project
description for details.

Good luck and happy searching!
iÿÿÿÿ(   t
   Directions(   t   Agent(   t   ActionsNt   GoWestAgentc           B   s   e  Z d  Z d „  Z RS(   s'   An agent that goes West until it can't.c         C   s'   t  j | j ƒ  k r t  j St  j Sd S(   s6   The agent receives a GameState (defined in pacman.py).N(   R    t   WESTt   getLegalPacmanActionst   STOP(   t   selft   state(    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyt	   getAction/   s    (   t   __name__t
   __module__t   __doc__R	   (    (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR   ,   s   t   SearchAgentc           B   s2   e  Z d  Z d d d d „ Z d „  Z d „  Z RS(   sš  
    This very general search agent finds a path using a supplied search
    algorithm for a supplied search problem, then returns actions to follow that
    path.

    As a default, this agent runs DFS on a PositionSearchProblem to find
    location (1,1)

    Options for fn include:
      depthFirstSearch or dfs
      breadthFirstSearch or bfs


    Note: You should NOT change any code in SearchAgent
    t   depthFirstSearcht   PositionSearchProblemt   nullHeuristicc            s$  | t  t ƒ k r" t | d ‚ n  t t | ƒ ‰  d ˆ  j j k rX d | GHˆ  |  _ nz | t ƒ  j ƒ  k r} t ƒ  | ‰ n1 | t  t ƒ k r¡ t t | ƒ ‰ n t | d ‚ d | | f GH‡  ‡ f d †  |  _ | t ƒ  j ƒ  k s÷ | j	 d ƒ rt | d ‚ n  t ƒ  | |  _
 d	 | GHd  S(
   Ns'    is not a search function in search.py.t	   heuristics   [SearchAgent] using function s3    is not a function in searchAgents.py or search.py.s0   [SearchAgent] using function %s and heuristic %sc            s   ˆ  |  d ˆ ƒS(   NR   (    (   t   x(   t   funct   heur(    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyt   <lambda>_   s    t   Problems1    is not a search problem type in SearchAgents.py.s!   [SearchAgent] using problem type (   t   dirt   searcht   AttributeErrort   getattrt	   func_codet   co_varnamest   searchFunctiont   globalst   keyst   endswitht
   searchType(   R   t   fnt   probR   (    (   R   R   sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyt   __init__L   s"    	%c         C   s˜   |  j  d k r t d ‚ n  t j ƒ  } |  j | ƒ } |  j  | ƒ |  _ | j |  j ƒ } d | t j ƒ  | f GHd t | ƒ k r” d | j GHn  d S(   sL  
        This is the first time that the agent sees the layout of the game
        board. Here, we choose a path to the goal. In this phase, the agent
        should compute the path to the goal and store it in a local variable.
        All of the work is done in this method!

        state: a GameState object (pacman.py)
        s+   No search function provided for SearchAgents0   Path found with total cost of %d in %.1f secondst	   _expandeds   Search nodes expanded: %dN(	   R   t   Nonet	   Exceptiont   timeR!   t   actionst   getCostOfActionsR   R%   (   R   R   t	   starttimet   problemt	   totalCost(    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyt   registerInitialStateg   s    	  c         C   sa   d t  |  ƒ k r d |  _ n  |  j } |  j d 7_ | t |  j ƒ k  rV |  j | St j Sd S(   sÝ   
        Returns the next action in the path chosen earlier (in
        registerInitialState).  Return Directions.STOP if there is no further
        action to take.

        state: a GameState object (pacman.py)
        t   actionIndexi    i   N(   R   R/   t   lenR)   R    R   (   R   R   t   i(    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR	   x   s     	(   R
   R   R   R$   R.   R	   (    (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR   ;   s   	R   c           B   sM   e  Z d  Z d „  d d	 e e d „ Z d „  Z d „  Z d „  Z d „  Z	 RS(
   sc  
    A search problem defines the state space, start state, goal test, successor
    function and cost function.  This search problem can be used to find paths
    to a particular point on the pacman board.

    The state space consists of (x,y) positions in a pacman game.

    Note: this search problem is fully specified; you should NOT change it.
    c         C   s   d S(   Ni   (    (   R   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR   “   s    i   c         C   s¢   | j  ƒ  |  _ | j ƒ  |  _ | d k r6 | |  _ n  | |  _ | |  _ | |  _ | r | j ƒ  d k sy | j	 | Œ  r d GHn  i  g  d |  _
 |  _ |  _ d S(   sÙ   
        Stores the start and goal.

        gameState: A GameState object (pacman.py)
        costFn: A function from a search state (tuple) to a non-negative number
        goal: A position in the gameState
        i   s6   Warning: this does not look like a regular search mazei    N(   t   getWallst   wallst   getPacmanPositiont
   startStateR&   t   goalt   costFnt	   visualizet
   getNumFoodt   hasFoodt   _visitedt   _visitedlistR%   (   R   t	   gameStateR7   R6   t   startt   warnR8   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR$   “   s     			(c         C   s   |  j  S(   N(   R5   (   R   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyt   getStartState§   s    c         C   s   | |  j  k } | r} |  j r} |  j j | ƒ d d  l } d t | ƒ k r} d t | j ƒ k rz | j j |  j ƒ qz q} n  | S(   Niÿÿÿÿt   _displayt   drawExpandedCells(   R6   R8   R<   t   appendt   __main__R   RA   RB   (   R   R   t   isGoalRD   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyt   isGoalStateª   s    c         C   sø   g  } x­ t  j t  j t  j t  j g D] } | \ } } t j | ƒ \ } } t | | ƒ t | | ƒ } }	 |  j | |	 s% | |	 f }
 |  j	 |
 ƒ } | j
 |
 | | f ƒ q% q% W|  j d 7_ | |  j k rô t |  j | <|  j j
 | ƒ n  | S(   s«  
        Returns successor states, the actions they require, and a cost of 1.

         As noted in search.py:
             For a given state, this should return a list of triples,
         (successor, action, stepCost), where 'successor' is a
         successor to the current state, 'action' is the action
         required to get there, and 'stepCost' is the incremental
         cost of expanding to that successor
        i   (   R    t   NORTHt   SOUTHt   EASTR   R   t   directionToVectort   intR3   R7   RC   R%   R;   t   TrueR<   (   R   R   t
   successorst   actionR   t   yt   dxt   dyt   nextxt   nextyt	   nextStatet   cost(    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyt   getSuccessors·   s    %!c         C   s¡   | d k r d S|  j ƒ  \ } } d } xr | D]j } t j | ƒ \ } } t | | ƒ t | | ƒ } } |  j | | r€ d S| |  j | | f ƒ 7} q/ W| S(   sˆ   
        Returns the cost of a particular sequence of actions. If those actions
        include an illegal move, return 999999.
        i?B i    N(   R&   R@   R   RJ   RK   R3   R7   (   R   R)   R   RO   RU   RN   RP   RQ   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR*   Õ   s     ! (   i   i   N(
   R
   R   R   R&   RL   R$   R@   RF   RV   R*   (    (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR   ˆ   s   				t   StayEastSearchAgentc           B   s   e  Z d  Z d „  Z RS(   sÄ   
    An agent for position search with a cost function that penalizes being in
    positions on the West side of the board.

    The cost function for stepping into a position (x,y) is 1/2^x.
    c            s+   t  j |  _ d „  ‰  ‡  f d †  |  _ d  S(   Nc         S   s   d |  d S(   Ng      à?i    (    (   t   pos(    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR   î   s    c            s   t  |  ˆ  d d  t ƒ S(   Ni   (   i   i   (   R   R&   t   False(   R   (   R7   (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR   ï   s    (   R   t   uniformCostSearchR   R!   (   R   (    (   R7   sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR$   ì   s    	(   R
   R   R   R$   (    (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyRW   å   s   t   StayWestSearchAgentc           B   s   e  Z d  Z d „  Z RS(   sÂ   
    An agent for position search with a cost function that penalizes being in
    positions on the East side of the board.

    The cost function for stepping into a position (x,y) is 2^x.
    c            s+   t  j |  _ d „  ‰  ‡  f d †  |  _ d  S(   Nc         S   s   d |  d S(   Ni   i    (    (   RX   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR   ú   s    c            s   t  |  ˆ  ƒ S(   N(   R   (   R   (   R7   (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR   û   s    (   R   RZ   R   R!   (   R   (    (   R7   sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR$   ø   s    	(   R
   R   R   R$   (    (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR[   ñ   s   c         C   s;   |  } | j  } t | d | d ƒ t | d | d ƒ S(   s<   The Manhattan distance heuristic for a PositionSearchProblemi    i   (   R6   t   abs(   t   positionR,   t   infot   xy1t   xy2(    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyt   manhattanHeuristicý   s    	c         C   s;   |  } | j  } | d | d d | d | d d d S(   s<   The Euclidean distance heuristic for a PositionSearchProblemi    i   i   g      à?(   R6   (   R]   R,   R^   R_   R`   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyt   euclideanHeuristic  s    	t   CornersProblemc           B   s;   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s’   
    This search problem finds paths through all four corners of a layout.

    You must select a suitable state space and successor function
    c         C   s¨   | j  ƒ  |  _ | j ƒ  |  _ |  j j d |  j j d } } d d | f | d f | | f f |  _ x2 |  j D]' } | j | Œ  sp d t | ƒ GHqp qp Wd |  _	 d S(   sK   
        Stores the walls, pacman's starting position and corners.
        i   i   s   Warning: no food in corner i    N(   i   i   (
   R2   R3   R4   t   startingPositiont   heightt   widtht   cornersR:   t   strR%   (   R   t   startingGameStatet   topt   rightt   corner(    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR$     s    !'	c         C   s   t  j ƒ  d S(   sh   
        Returns the start state (in your state space, not the full Pacman state
        space)
        N(   t   utilt   raiseNotDefined(   R   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR@   $  s    c         C   s   t  j ƒ  d S(   sS   
        Returns whether this search state is a goal state of the problem.
        N(   Rm   Rn   (   R   R   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyRF   ,  s    c         C   sB   g  } x& t  j t  j t  j t  j g D] } q% W|  j d 7_ | S(   sª  
        Returns successor states, the actions they require, and a cost of 1.

         As noted in search.py:
            For a given state, this should return a list of triples, (successor,
            action, stepCost), where 'successor' is a successor to the current
            state, 'action' is the action required to get there, and 'stepCost'
            is the incremental cost of expanding to that successor
        i   (   R    RG   RH   RI   R   R%   (   R   R   RM   RN   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyRV   3  s
    %c         C   s…   | d k r d S|  j \ } } xY | D]Q } t j | ƒ \ } } t | | ƒ t | | ƒ } } |  j | | r& d Sq& Wt | ƒ S(   s§   
        Returns the cost of a particular sequence of actions.  If those actions
        include an illegal move, return 999999.  This is implemented for you.
        i?B N(   R&   Rd   R   RJ   RK   R3   R0   (   R   R)   R   RO   RN   RP   RQ   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR*   L  s     ! (   R
   R   R   R$   R@   RF   RV   R*   (    (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyRc     s   				c         C   s   | j  } | j } d S(   s«  
    A heuristic for the CornersProblem that you defined.

      state:   The current search state
               (a data structure you chose in your search problem)

      problem: The CornersProblem instance for this layout.

    This function should always return a number that is a lower bound on the
    shortest path from the state to a goal of the problem; i.e.  it should be
    admissible (as well as consistent).
    i    (   Rg   R3   (   R   R,   Rg   R3   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyt   cornersHeuristicZ  s    		t   AStarCornersAgentc           B   s   e  Z d  Z d „  Z RS(   sC   A SearchAgent for FoodSearchProblem using A* and your foodHeuristicc         C   s   d „  |  _  t |  _ d  S(   Nc         S   s   t  j |  t ƒ S(   N(   R   t   aStarSearchRo   (   R#   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR   p  s    (   R   Rc   R!   (   R   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR$   o  s    (   R
   R   R   R$   (    (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyRp   m  s   t   FoodSearchProblemc           B   s;   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   su  
    A search problem associated with finding the a path that collects all of the
    food (dots) in a Pacman game.

    A search state in this problem is a tuple ( pacmanPosition, foodGrid ) where
      pacmanPosition: a tuple (x,y) of integers specifying Pacman's position
      foodGrid:       a Grid (see game.py) of either True or False, specifying remaining food
    c         C   sI   | j  ƒ  | j ƒ  f |  _ | j ƒ  |  _ | |  _ d |  _ i  |  _ d  S(   Ni    (   R4   t   getFoodR>   R2   R3   Ri   R%   t   heuristicInfo(   R   Ri   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR$   |  s
    		c         C   s   |  j  S(   N(   R>   (   R   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR@   ƒ  s    c         C   s   | d j  ƒ  d k S(   Ni   i    (   t   count(   R   R   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyRF   †  s    c         C   sÜ   g  } |  j  d 7_  xÀ t j t j t j t j g D]  } | d \ } } t j | ƒ \ } } t | | ƒ t | | ƒ } }	 |  j	 | |	 s4 | d j
 ƒ  }
 t |
 | |	 <| j | |	 f |
 f | d f ƒ q4 q4 W| S(   sD   Returns successor states, the actions they require, and a cost of 1.i   i    (   R%   R    RG   RH   RI   R   R   RJ   RK   R3   t   copyRY   RC   (   R   R   RM   t	   directionR   RO   RP   RQ   RR   RS   t   nextFood(    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyRV   ‰  s    %!)c         C   s†   |  j  ƒ  d \ } } d } xc | D][ } t j | ƒ \ } } t | | ƒ t | | ƒ } } |  j | | rt d S| d 7} q# W| S(   sv   Returns the cost of a particular sequence of actions.  If those actions
        include an illegal move, return 999999i    i?B i   (   R@   R   RJ   RK   R3   (   R   R)   R   RO   RU   RN   RP   RQ   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR*   —  s    !(   R
   R   R   R$   R@   RF   RV   R*   (    (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyRr   s  s   				t   AStarFoodSearchAgentc           B   s   e  Z d  Z d „  Z RS(   sC   A SearchAgent for FoodSearchProblem using A* and your foodHeuristicc         C   s   d „  |  _  t |  _ d  S(   Nc         S   s   t  j |  t ƒ S(   N(   R   Rq   t   foodHeuristic(   R#   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR   ¨  s    (   R   Rr   R!   (   R   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR$   §  s    (   R
   R   R   R$   (    (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyRy   ¥  s   c         C   s   |  \ } } d S(   sò  
    Your heuristic for the FoodSearchProblem goes here.

    This heuristic must be consistent to ensure correctness.  First, try to come
    up with an admissible heuristic; almost all admissible heuristics will be
    consistent as well.

    If using A* ever finds a solution that is worse uniform cost search finds,
    your heuristic is *not* consistent, and probably not admissible!  On the
    other hand, inadmissible or inconsistent heuristics may find optimal
    solutions, so be careful.

    The state is a tuple ( pacmanPosition, foodGrid ) where foodGrid is a Grid
    (see game.py) of either True or False. You can call foodGrid.asList() to get
    a list of food coordinates instead.

    If you want access to info like walls, capsules, etc., you can query the
    problem.  For example, problem.walls gives you a Grid of where the walls
    are.

    If you want to *store* information to be reused in other calls to the
    heuristic, there is a dictionary called problem.heuristicInfo that you can
    use. For example, if you only want to count the walls once and store that
    value, try: problem.heuristicInfo['wallCount'] = problem.walls.count()
    Subsequent calls to this heuristic can access
    problem.heuristicInfo['wallCount']
    i    (    (   R   R,   R]   t   foodGrid(    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyRz   «  s    t   ClosestDotSearchAgentc           B   s    e  Z d  Z d „  Z d „  Z RS(   s0   Search for all food using a sequence of searchesc         C   sÎ   g  |  _  | } x | j ƒ  j ƒ  d k r® |  j | ƒ } |  j  | 7_  x` | D]X } | j ƒ  } | | k r• t | ƒ t | ƒ f } t d | ‚ n  | j d | ƒ } qO Wq Wd |  _ d t	 |  j  ƒ GHd  S(   Ni    s5   findPathToClosestDot returned an illegal move: %s!
%ss   Path found with cost %d.(
   R)   Rs   Ru   t   findPathToClosestDott   getLegalActionsRh   R'   t   generateSuccessorR/   R0   (   R   R   t   currentStatet   nextPathSegmentRN   t   legalt   t(    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR.   Í  s    		c         C   s>   | j  ƒ  } | j ƒ  } | j ƒ  } t | ƒ } t j ƒ  d S(   si   
        Returns a path (a list of actions) to the closest dot, starting from
        gameState.
        N(   R4   Rs   R2   t   AnyFoodSearchProblemRm   Rn   (   R   R=   t   startPositiont   foodR3   R,   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR}   Ü  s
    (   R
   R   R   R.   R}   (    (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR|   Ë  s   	R„   c           B   s    e  Z d  Z d „  Z d „  Z RS(   sé  
    A search problem for finding a path to any food.

    This search problem is just like the PositionSearchProblem, but has a
    different goal test, which you need to fill in below.  The state space and
    successor function do not need to be changed.

    The class definition above, AnyFoodSearchProblem(PositionSearchProblem),
    inherits the methods of the PositionSearchProblem.

    You can use this search problem to help you fill in the findPathToClosestDot
    method.
    c         C   sZ   | j  ƒ  |  _ | j ƒ  |  _ | j ƒ  |  _ d „  |  _ i  g  d |  _ |  _ |  _	 d S(   sF   Stores information from the gameState.  You don't need to change this.c         S   s   d S(   Ni   (    (   R   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR     s    i    N(
   Rs   R†   R2   R3   R4   R5   R7   R;   R<   R%   (   R   R=   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR$   ù  s
    c         C   s   | \ } } t  j ƒ  d S(   s‚   
        The state is Pacman's position. Fill this in with a goal test that will
        complete the problem definition.
        N(   Rm   Rn   (   R   R   R   RO   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyRF     s    (   R
   R   R   R$   RF   (    (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyR„   ê  s   	c   	   
   C   s¥   |  \ } } | \ } } | j  ƒ  } | | | sI t d t |  ƒ ƒ ‚ | | | sn t d t | ƒ ƒ ‚ t | d |  d | d t d t ƒ} t t j | ƒ ƒ S(   sQ  
    Returns the maze distance between any two points, using the search functions
    you have already built. The gameState can be any game state -- Pacman's
    position in that state is ignored.

    Example usage: mazeDistance( (2,4), (5,6), gameState)

    This might be a useful helper function for your ApproximateSearchAgent.
    s   point1 is a wall: s   point2 is a wall: R>   R6   R?   R8   (   R2   t   AssertionErrorRh   R   RY   R0   R   t   bfs(	   t   point1t   point2R=   t   x1t   y1t   x2t   y2R3   R#   (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyt   mazeDistance  s    
%%$(    (   R   t   gameR    R   R   Rm   R(   R   R   R   t   SearchProblemR   RW   R[   Ra   Rb   Rc   Ro   Rp   Rr   Ry   Rz   R|   R„   R   (    (    (    sM   /Users/saia/public_html/classes/527-s18/proj/proj1/old/search/searchAgents.pyt   <module>#   s,   M]
M	2	 $