示例#1
0
        private void button6_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();
            CubeSolverBeginner cs = new CubeSolverBeginner(rubikRenderer.RubikManager);

            if (cs.CanSolve())
            {
                RubikManager ma = cs.ReturnRubik();
                ma.OnRotatingFinished += RotatingFinished;
                ma.Moves.ForEach(m =>
                {
                    if (m.Layer == Cube3D.RubikPosition.TopLayer || m.Layer == Cube3D.RubikPosition.LeftSlice || m.Layer == Cube3D.RubikPosition.FrontSlice)
                    {
                        m.Direction = !m.Direction;
                    }
                    listBox1.Items.Add(m.Layer.ToString() + " " + ((m.Direction) ? "Clockwise" : "Counter-Clockwise"));
                });
                if (listBox1.Items.Count > 0)
                {
                    listBox1.SelectedIndex = 0;
                }
                listBox1.Focus();
            }
            else
            {
                MessageBox.Show("Insoluble cube");
            }
            this.Invalidate();
        }
示例#2
0
        private void solveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CubeSolverBeginner cs = new CubeSolverBeginner(rubikRenderer.RubikManager);

            if (cs.CanSolve())
            {
                rubikRenderer.RubikManager = cs.ReturnRubik().Clone();
                rubikRenderer.RubikManager.Moves.Clear();
            }
            else
            {
                MessageBox.Show("Insoluble cube");
            }
        }