import java.util.*;

/**
 * A map of the tunnel system.
 */

public class Map
{
    public Map (Vector<String> input, boolean debug)
    {
        _theMap = new Vector<Cell>();
        _debug = debug;

        createMap(input);
    }

    public Coordinate getEntrance ()
    {
        Enumeration<Cell> iter = _theMap.elements();

        while (iter.hasMoreElements())
        {
            Cell theCell = iter.nextElement();

            if (theCell.isEntrance())
                return theCell.position();
        }

        return null;  // oops!!
    }

    @Override
    public String toString ()
    {
        Enumeration<Cell> iter = _theMap.elements();
        int index = 1;
        String str = "Map <"+(_maxX+1)+", "+(_maxY+1)+">:\n\n";

        while (iter.hasMoreElements())
        {
            str += iter.nextElement().getContents();

            if (index++ == _maxX)
            {
                str += "\n";

                index = 1;
            }
        }

        return str;
    }

    private void createMap (Vector<String> input)
    {
        Enumeration<String> iter = input.elements();
        int y = -1;

        _maxX = input.get(0).length(); // all lines are the same length

        while (iter.hasMoreElements())
        {
            y++;

            String line = iter.nextElement();

            for (int x = 0; x < _maxX; x++)
            {
                Cell theCell = new Cell(new Coordinate(x, y), line.charAt(x), _debug);

                if (_debug)
                    System.out.println(theCell);

                _theMap.add(theCell);
            }
        }

        _maxY = y;
    }



    private Vector<Cell> _theMap;
    private int _maxX;
    private int _maxY;
    private boolean _debug;
}
@@ -1463,24 +1463,141 @@
 , _debug);%0A%0A
+                if (theCell.isEntrance)%0A                    _entrance = theCell.position();  // should be only one!%0A%0A
             
@@ -1608,24 +1608,24 @@
 if (_debug)%0A
-
             
@@ -1751,17 +1751,116 @@
 %0A    %7D%0A%0A
+    private void createGraph ()%0A    %7B%0A        // start at entrance and work outwards%0A        %0A    %7D
 %0A
-
 %0A    pri
@@ -1909,16 +1909,16 @@
  _maxX;%0A
-
     priv
@@ -1932,16 +1932,50 @@
  _maxY;%0A
+    private Coordinate _entrance;%0A
     priv

Update Map.java