public class Image
{
    /*
     * 144 tiles in the example. Hard wire
     * this for now but could make it dynamic.
     */

    public static final int MAX_X = 12;
    public static final int MAX_Y = 12;

    public static final String NO_TILE = "xxxxxxxx";

    public Image (boolean debug)
    {
        this(MAX_Y, MAX_X, debug);
    }

    public Image (int y, int x, boolean debug)
    {
        _theWorld = new Tile[y][x];

        for (int i = 0; i < y; i++)
        {
            for (int j = 0; j < x; j++)
            {
                _theWorld[i][j] = null;
            }
        }

        _debug = debug;
    }

    public void addTile (int x, int y, Tile t)
    {
        _theWorld[y][x] = t.removeBorders();

        System.out.println("Added "+t.removeBorders()+" to "+x+" "+y);
    }

    @Override
    public String toString ()
    {
        String str = "";

        for (int i = 0; i < _theWorld.length; i++)
        {
            for (int j = 0; j < _theWorld[0].length; j++)
            {
                Tile t = _theWorld[i][j];
                int index = 0;

                if (t != null)
                {
                    int maxIndex = t.numberOfLines();

                    while (index < maxIndex)
                    {
                        str += t.line(index);

                        index++;
                    }
                }
                else
                    str += NO_TILE;

                str += "\n";
            }
        }

        return str;
    }

    private Tile[][] _theWorld;
    private boolean _debug;
}
@@ -874,17 +874,100 @@
 r = %22%22;%0A
+        
 %0A
+        int index = 0;%0A        int maxIndex = 0;%0A%0A        do%0A        %7B%0A    
         
@@ -1009,32 +1009,36 @@
 h; i++)%0A        
+    
 %7B%0A            fo
@@ -1027,32 +1027,36 @@
   %7B%0A            
+ 
+   
 for (int j = 0; 
@@ -1089,34 +1089,42 @@
 ++)%0A            
-%7B%0A
+    %7B%0A    
                 
@@ -1149,23 +1149,17 @@
 %5Bi%5D%5Bj%5D;%0A
-       
+%0A
         
@@ -1163,24 +1163,8 @@
     
-int index = 0;%0A%0A
     
@@ -1170,21 +1170,16 @@
         
-     
 if (t !=
@@ -1185,16 +1185,20 @@
 = null)%0A
+    
         
@@ -1231,153 +1231,86 @@
     
-int maxIndex = t.numberOfLines();%0A%0A                    while (index %3C maxIndex)%0A                    %7B%0A                        str += t.line(index
+    str += t.line(index);%0A%0A                        maxIndex = t.numberOfLines(
 );%0A%0A
@@ -1364,38 +1364,24 @@
       %7D%0A    
-            %7D%0A
             
@@ -1389,16 +1389,20 @@
    else%0A
+    
         
@@ -1428,16 +1428,34 @@
 NO_TILE;
+%0A                %7D
 %0A%0A      
@@ -1483,32 +1483,33 @@
 ;%0A            %7D%0A
+%0A
         %7D%0A%0A     
@@ -1493,32 +1493,58 @@
     %7D%0A%0A        %7D
+ while (index %3C maxIndex);
 %0A%0A        return

Update Image.java