Пример #1
0
        /// <summary>
        /// Builds the yellow cross for OLL.
        /// </summary>
        private void BuildYellowCross()
        {
            foreach (RubiksColor col in SideColors)
            {
                // Sets the view.
                ChangeView(new CubeView(col, FINAL_COLOR));

                // Gets the configuration.
                LastLayerConfiguration config = new LastLayerConfiguration(_cube.GetFaceCubies(Face.Up));

                // Uses the correct algorithm if any match is found.
                if (config.Matches(OllCases.YellowCenter))
                {
                    // If the configuration matches the yellow center case, another algorithm will be needed.
                    AddMoveList(Algorithms.OLLCross1);
                    BuildYellowCross();
                }
                else if (config.Matches(OllCases.YellowL))
                {
                    AddMoveList(Algorithms.OLLCross2);
                }
                else if (config.Matches(OllCases.YellowLine))
                {
                    AddMoveList(Algorithms.OLLCross1);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Executes the OLL phase.
        /// </summary>
        private void OLL()
        {
            // The first thing to do is to build a yellow cross.
            BuildYellowCross();

            // Gets the configuration of the last layer.
            LastLayerConfiguration conf = new LastLayerConfiguration(_cube.GetFaceCubies(Face.Up));

            // Keeps on changing the view until OLL is complete.
            for (int c = 0; !conf.Matches(OllCases.OLLComplete); c++)
            {
                // Sets the view.
                ChangeView(new CubeView(SideColors[c], FINAL_COLOR));

                // Gets the configuration before the algorithms.
                conf = new LastLayerConfiguration(_cube.GetFaceCubies(Face.Up));

                // If the configuration matches any of the situations, the proper algorithm will be used.
                if (conf.Matches(OllCases.OLLSituation1))
                {
                    AddMoveList(Algorithms.OLLSituation1);
                }
                else if (conf.Matches(OllCases.OLLSituation2))
                {
                    AddMoveList(Algorithms.OLLSituation2);
                }
                else if (conf.Matches(OllCases.OLLSituation3))
                {
                    AddMoveList(Algorithms.OLLSituation3);
                }
                else if (conf.Matches(OllCases.OLLSituation4))
                {
                    AddMoveList(Algorithms.OLLSituation4);
                }
                else if (conf.Matches(OllCases.OLLSituation5))
                {
                    AddMoveList(Algorithms.OLLSituation5);
                }
                else if (conf.Matches(OllCases.OLLSituation6))
                {
                    AddMoveList(Algorithms.OLLSituation6);
                }
                else if (conf.Matches(OllCases.OLLSituation7))
                {
                    AddMoveList(Algorithms.OLLSituation7);
                }

                // Gets the configuration after the algorithms.
                conf = new LastLayerConfiguration(_cube.GetFaceCubies(Face.Up));
            }
        }