public static void generate(int[] pattern)
    {
        for (int i = 0; i < 4; i++) {
            if (pattern[i] < 0 || pattern[i] > 3) {
                pattern[i] = 4;
                for (int j = i+1; j < 5; j++) {
                    if (pattern[j] < 0 || pattern[j] > 3) {
                        pattern[j] = 5;
                        for (int k = j+1; k < 6; k++) {
                            if (pattern[k] < 0 || pattern[k] > 3) {
                                pattern[k] = 6;
                                display(pattern);
                                return;
                            }
                        }
                    }
                }   
            }
        }
    }