Beispiel #1
0
        /// <summary>
        /// this function gives values to the mouse position for use later.
        /// this also makes sure the user cant break the code by making the mouse
        /// go places i dont want them to.
        /// this also does the zooming functions on the scroll wheel and when pressed down will scramble.
        /// </summary>
        private void ReadMouse()
        {
            MouseState state = mouse.CurrentMouseState;

            mousepos.X = state.X;
            mousepos.Y = state.Y;
            mousepos.Z = state.Z;


            byte[] buttons = state.GetMouseButtons();
            if (buttons[1] != 0) //right button
            {
                float mx = mouse.CurrentMouseState.X;
                float my = mouse.CurrentMouseState.Y;
                //for the pen input, it goes insainly fast
                if (Math.Abs(mousepos.X) > 10)
                {
                    mousepos.X = mousepos.X % 10;
                }
                if (Math.Abs(mousepos.Y) > 10)
                {
                    mousepos.Y = mousepos.Y % 10;
                }
                theta += Geometry.DegreeToRadian(mousepos.X);
                phi   += Geometry.DegreeToRadian(mousepos.Y);
            }
            float Dif = mousepos.Z - OldZ;

            OldZ = mousepos.Z;
            if (Dif != 0) //scroll wheel
            {
                if (keyboard.GetCurrentKeyboardState()[Key.LeftControl])
                {
                    spacing -= 0.0005f * Dif;
                    Console.WriteLine("rho = " + rho + " phi = " + phi + " theta = " + theta + " spacing = " + spacing);
                }
                else
                {
                    rho += 0.005 * Dif;
                }
            }


            if (buttons[2] != 0) //middle button
            {
                if (!middle)
                {
                    rubixCube.Scramble();
                }
            }
            middle = buttons[2] == 0;
            //mouse.
        }
Beispiel #2
0
        private void ReadMouse()
        {
            MouseState state = mouse.CurrentMouseState;

            mousepos.X = state.X;
            mousepos.Y = state.Y;
            mousepos.Z = state.Z;

            byte[] buttons = state.GetMouseButtons();
            if (buttons[1] != 0) //right button
            {
                float mx = mouse.CurrentMouseState.X;
                float my = mouse.CurrentMouseState.Y;
                //for the pen input, it goes insainly fast
                if (Math.Abs(mousepos.X) > 10)
                {
                    //mousepos.X = mousepos.X%10;
                }
                if (Math.Abs(mousepos.Y) > 10)
                {
                    //mousepos.Y = mousepos.Y%10;
                }
                theta += Geometry.DegreeToRadian(mousepos.X);
                phi   += Geometry.DegreeToRadian(mousepos.Y);
            }
            if (mousepos.Z > 0) //scroll wheel
            {
                if (keyboard.GetCurrentKeyboardState()[Key.LeftControl])
                {
                    spacing -= .1f;
                }
                else
                {
                    rho -= 1;
                }
            }
            else if (mousepos.Z < 0)
            {
                if (keyboard.GetCurrentKeyboardState()[Key.LeftControl])
                {
                    spacing += .1f;
                }
                else
                {
                    rho += 1;
                }
            }
            if (buttons[2] != 0) //middle button
            {
                if (!middle)
                {
                    rubixCube.Scramble();
                }
            }
            middle = buttons[2] == 0;
            //mouse.
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Cube   testCube   = new Cube();
            Solver testSolver = new Solver(testCube);

            //testprint();
            Console.WriteLine("Top Cross solved before scramble: {0}", testSolver.WhiteCrossSolved());
            Console.WriteLine("Middle Layer solved before scramble: {0}", testSolver.MiddleLayerSolved());
            testCube.Scramble();

            /****  failing test case *********/
            /***********************************/

            Console.WriteLine("Top cross solved after scramble:  {0}", testSolver.WhiteCrossSolved());
            Console.WriteLine("Top layer solved after scramble:  {0}", testSolver.WhiteCornersSolved());
            Console.WriteLine("Middle Level solved after scramble:  {0}", testSolver.MiddleLayerSolved());
            testSolver.SolveWhiteCross();
            Console.WriteLine("Top cross solved after solve (cross):  {0}", testSolver.WhiteCrossSolved());
            testSolver.SolveWhiteCorners();
            Console.WriteLine("Top layer solved after solve (corners):  {0}", testSolver.WhiteCornersSolved());
            //testSolver.SolveMiddleLayer(Color.Red);
            Console.WriteLine("Middle layer solved after solve:  {0}", testSolver.MiddleLayerSolved());
            Console.ReadLine();
        }