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 = "";
        
        int index = 0;
        int maxIndex = 0;

        do
        {
            for (int i = 0; i < _theWorld.length; i++)
            {
                System.out.println("size "+_theWorld[0].length);
                
                for (int j = 0; j < _theWorld[0].length; j++)
                {
                    Tile t = _theWorld[i][j];

                    if (t != null)
                    {
                        System.out.println("Tile "+t.getID()+" line "+index+" is "+t.line(index));
                        System.out.println("So far\n"+str);

                        str += t.line(index);

                        System.out.println("Now\n"+str);

                        maxIndex = t.numberOfLines();
                    }
                    else
                        str += NO_TILE;
                }

                str += "\n";
            }

            index++;

        } while (index < maxIndex);

        return str;
    }

    private Tile[][] _theWorld;
    private boolean _debug;
}
@@ -205,62 +205,8 @@
 2;%0A%0A
-    public static final String NO_TILE = %22xxxxxxxx%22;%0A%0A
     
@@ -832,56 +832,69 @@
     
-%0A        int index = 0;%0A        int maxIndex = 0
+int y = _theWorld.length;%0A        int x = _theWorld%5B0%5D.length
 ;%0A%0A 
@@ -904,10 +904,10 @@
     
-do
+/*
 %0A   
@@ -915,160 +915,108 @@
     
-%7B%0A            for (int i = 0; i %3C _theWorld.length; i++)%0A            %7B%0A                System.out.println(%22size %22+_theWorld%5B0%5D.length);%0A        
+0,0 0,1 0,2%0A        1,0 1,1 1,2%0A        2,0 2,1 2,2%0A*/%0A%0A        for (int i = 0; i %3C y; i++)%0A
         
 %0A   
@@ -1011,18 +1011,18 @@
         
+%7B
 %0A
- 
         
@@ -1017,35 +1017,32 @@
   %7B%0A            
-   
 for (int j = 0; 
@@ -1038,49 +1038,39 @@
 int 
-j
+index
  = 0; 
-j %3C _theWorld%5B0%5D.length; j++)%0A    
+index %3C x; index++)%0A
     
@@ -1095,20 +1095,16 @@
         
-    
 Tile t =
@@ -1121,17 +1121,17 @@
 %5Bi%5D%5B
-j%5D;%0A%0A    
+index%5D;%0A%0A
     
@@ -1157,20 +1157,16 @@
 = null)%0A
-    
         
@@ -1199,304 +1199,113 @@
     
-    System.out.println(%22Tile %22+t.getID()+%22 line %22+index+%22 is %22+t.line(index));%0A                        System.out.println(%22So far%5Cn%22+str);%0A%0A                        str += t.line(index);%0A%0A                        System.out.println(%22Now%5Cn%22+str);%0A%0A                        maxIndex = t.numberOfL
+for (int j = 0; j %3C t.numberOfLines(); j++)%0A                    %7B%0A                        str += t.l
 ine
-s
 (
+j
 );%0A 
@@ -1329,73 +1329,8 @@
   %7D%0A
-                    else%0A                        str += NO_TILE;%0A
     
@@ -1404,53 +1404,30 @@
     
-index++;%0A%0A        %7D while (index %3C maxIndex);
+str += %22%5Cn%22;%0A        %7D
 %0A%0A  

Update Image.java