boolean fillBoard(SudokuBoardGenerator board, int x, int y) {
        //check if reached the end of the board
        if (x == 0 && y == 9) {
            return true;
        }
        //jumps over already filled in fields
        while (!board.empty(x, y)) {
            if (x == 8) {
                y++;
                x = 0;
            } else {
                x++;
            }
            if (x == 0 && y == 9) {
                return true;
            }
        }
        permute();
        int[] copy = new int[9];
        System.arraycopy(permut_array, 0, copy, 0, permut_array.length);
        //tries to find a valid number for the current field
        for (int i = 0; i < 9; i++) {
            if (valid(x, y, copy[i])) {
                board.put(x, y, copy[i]);
                if (fillBoard(board, incrX(x), incrY(x, y))) {
                    return true;
                }
            }
        }
        board.put(x, y, 0);
        return false;
    }