Hi,

I'm quite new to java. I'm trying to make a tromino puzzle (Golomb's inductive proof of a tromino theorem) using recursion and a divide-and-conquer method. The only thing I need to obtain is a matrix (2D-array) filled with ints. A tromino is formed by 3 same numbers (e.g. array[0][0] = 1, array[0][1] = 1 and array[1][0] = 1 form 1 tromino-shape. The little black square is represented as -1). I managed to do this for one square, but I have no idea how I can possibly fill the whole matrix. Any help? Thanks!

Java Code:
public class TrominoPuzzle {

    private int[][] tile;
    private int counter;

    public int[][] tile(int k, int row, int col) {
        int tilelength = (int) Math.pow(2, k);
        tile = new int[tilelength][tilelength];
        tile[row][col] = -1;
        counter = 1;
        drawTromino(8,row,col);

        return tile;
    }

    public void drawTromino(int length, int row, int col) {
        if (length != 1) {
            if (row <= length/2 && col <= length/2) {
                tile[length/2-1][length/2] = counter;
                tile[length/2][length/2] = counter;
                tile[length/2][length/2-1] = counter;
                counter++;
                drawTromino(length/2,length/2-1,length/2-1);
            }
            if (row <= length/2 && col > length/2) {
                tile[length/2-1][length/2-1] = counter;
                tile[length/2][length/2-1] = 55;
                tile[length/2-1][length/2] = counter;
                counter++;
                drawTromino(length/2,length/2-1,length/2);
            }
            if (row > length/2 && col <= length/2) {
                tile[length/2-1][length/2-1] = counter;
                tile[length/2-1][length/2] = counter;
                tile[length/2][length/2] = counter;
                counter++;
                drawTromino(length/2,length/2,length/2-1);
            }
            if (row > length/2 && col > length/2) {
                tile[length/2-1][length/2-1] = counter;
                tile[length/2-1][length/2] = counter;
                tile[length/2][length/2-1] = counter;
                counter++;
                drawTromino(length/2,length/2,length/2);
            }
        }
    }
}