Exemple #1
0
        private void Solve1(List <string> res)
        {
            Dictionary <int, string> solv1up = new Dictionary <int, string> {
                { 40, "L2 Uz" },
                { 9, "B2 U2" },
                { 12, "R2 U" },
                { 24, "F2" },
                { 33, "L Uz Lz" },
                { 5, "Rz U R" },
                { 48, "Lz Uz L" },
                { 20, "R U Rz" },
                { 34, "Uz" },
                { 18, "" },
                { 6, "U" },
                { 3, "U2" }
            };

            Dictionary <int, string> solv1down = new Dictionary <int, string> {
                { 32, "U L2" },
                { 40, "Fz L F" },
                { 1, "U2 B2" },
                { 9, "U Lz B L" },
                { 4, "Uz R2" },
                { 12, "F Rz Fz" },
                { 16, "F2" },
                { 24, "Uz Rz F R" }
            };

            var temp = new List <Pair>()
            {
                new Pair(WHITE, GREEN),
                new Pair(WHITE, RED),
                new Pair(WHITE, BLUE),
                new Pair(WHITE, ORANGE)
            };

            foreach (Pair p in temp)
            {
                BiPlace b = Find2(p.a, p.b);
                if (state[b.S1][b.I1] == b.S1 && state[b.S2][b.I2] == b.S2)
                {
                    continue;
                }
                res.Add(solv1up[Mask(b.S1, b.S2)]);
                DoFormula(solv1up[Mask(b.S1, b.S2)]);
                b = Find2(p.a, p.b);
                int key = Mask(p.b, state[GREEN][1]);
                res.Add(solv1down[key]);
                DoFormula(solv1down[key]);
            }
        }
Exemple #2
0
        private BiPlace Find2(int c1, int c2)
        {
            List <Pair> bis = new List <Pair>()
            {
                new Pair(BLUE, YELLOW),
                new Pair(BLUE, RED),
                new Pair(BLUE, WHITE),
                new Pair(BLUE, ORANGE),

                new Pair(YELLOW, ORANGE),
                new Pair(YELLOW, RED),
                new Pair(YELLOW, GREEN),

                new Pair(RED, GREEN),
                new Pair(RED, WHITE),

                new Pair(ORANGE, GREEN),
                new Pair(ORANGE, WHITE),

                new Pair(GREEN, WHITE)
            };

            foreach (Pair p in bis)
            {
                BiPlace b    = (BiPlace)GetByMask(Mask(p.a, p.b));
                int     col1 = state[b.S1][b.I1];
                int     col2 = state[b.S2][b.I2];
                if (col1 == c1 && col2 == c2)
                {
                    return(new BiPlace(b.S1, b.I1, b.S2, b.I2));
                }
                else if (col1 == c2 && col2 == c1)
                {
                    return(new BiPlace(b.S2, b.I2, b.S1, b.I1));
                }
            }
            return(new BiPlace(-1, -1, -1, -1));
        }
Exemple #3
0
        private void Solve3(List <string> res)
        {
            Dictionary <int, string> solv3up = new Dictionary <int, string> {
                { 33, "Uz Bz U B U L Uz Lz" },
                { 5, "U B Uz Bz Uz Rz U R" },
                { 48, "Uz Lz U L U F Uz Fz" },
                { 20, "U R Uz Rz Uz Fz U F" }
            };

            Dictionary <string, string> solv3down = new Dictionary <string, string> {
                { $"{BLUE}{RED}|{RED}", "Uz Bz U B U L Uz Lz" },
                { $"{BLUE}{RED}|{BLUE}", "U L Uz Lz Uz Bz U B" },
                { $"{BLUE}{ORANGE}|{ORANGE}", "U B Uz Bz Uz Rz U R" },
                { $"{BLUE}{ORANGE}|{BLUE}", "Uz Rz U R U B Uz Bz" },
                { $"{GREEN}{RED}|{GREEN}", "Uz Lz U L U F Uz Fz" },
                { $"{GREEN}{RED}|{RED}", "U F Uz Fz Uz Lz U L" },
                { $"{GREEN}{ORANGE}|{GREEN}", "U R Uz Rz Uz Fz U F" },
                { $"{GREEN}{ORANGE}|{ORANGE}", "Uz Fz U F U R Uz Rz" }
            };

            var temp = new List <Pair>()
            {
                new Pair(BLUE, RED),
                new Pair(BLUE, ORANGE),
                new Pair(GREEN, RED),
                new Pair(GREEN, ORANGE)
            };
            string formulaBuffer;
            string key;

            foreach (Pair p in temp)
            {
                BiPlace b = Find2(p.a, p.b);
                if (state[b.S1][b.I1] == b.S1 && state[b.S2][b.I2] == b.S2)
                {
                    continue;
                }

                if (b.S1 != YELLOW && b.S2 != YELLOW)
                {
                    formulaBuffer = solv3up[Mask(b.S1, b.S2)];
                    res.Add(formulaBuffer);
                    DoFormula(formulaBuffer);
                }

                b = Find2(p.a, p.b);
                while (p.a != b.S1 && p.b != b.S2)
                {
                    formulaBuffer = "U";
                    res.Add(formulaBuffer);
                    DoFormula(formulaBuffer);
                    b = Find2(p.a, p.b);
                }

                if (p.a == b.S1)
                {
                    key = $"{p.a}{p.b}|{p.a}";
                }
                else
                {
                    key = $"{p.a}{p.b}|{p.b}";
                }

                formulaBuffer = solv3down[key];
                res.Add(formulaBuffer);
                DoFormula(formulaBuffer);
            }
        }