コード例 #1
0
        public void Update()
        {
            KeyboardState keyboardState = Keyboard.GetState();

            if (keyboardState.IsKeyDown(Keys.D1) && oldKeyboardState.IsKeyUp(Keys.D1))
            {
                isFirstTime = true;
                StatesChecked.Clear();
                StatesToCheck.Clear();
                RunTree();
            }
            if (keyboardState.IsKeyDown(Keys.D2) && oldKeyboardState.IsKeyUp(Keys.D2))
            {
                Debug.WriteLine(GetCubeValue(CubeState));
            }
            userState        = CubeState.GetCubeState();
            oldKeyboardState = keyboardState;
        }
コード例 #2
0
 public bool AreSame(CubeConfig first, CubeConfig second)
 {
     for (int i = 0; i < 6; i++)
     {
         string[,] firstState = first.GetCubeState()[i];
         string[,] secondState = second.GetCubeState()[i];
         for (int x = 0; x < 3; x++)
         {
             for (int y = 0; y < 3; y++)
             {
                 if (firstState[x, y] != secondState[x, y])
                     return false;
             }
         }
     }
     return true;
 }
コード例 #3
0
 public bool AreSame(CubeConfig first, CubeConfig second)
 {
     for (int i = 0; i < 6; i++)
     {
         string[,] firstState  = first.GetCubeState()[i];
         string[,] secondState = second.GetCubeState()[i];
         for (int x = 0; x < 3; x++)
         {
             for (int y = 0; y < 3; y++)
             {
                 if (firstState[x, y] != secondState[x, y])
                 {
                     return(false);
                 }
             }
         }
     }
     return(true);
 }
コード例 #4
0
        public int GetCubeValue(CubeConfig cubeState)
        {
            var state = cubeState.GetCubeState();
            int value = 0;

            for (int i = 0; i < state.Count; i++)
            {
                string[,] currentFace = state[i];
                string[,] targetFace  = targetState[i];
                for (int x = 0; x < 3; x++)
                {
                    for (int y = 0; y < 3; y++)
                    {
                        if (currentFace[x, y] != targetFace[x, y])
                        {
                            value++;
                        }
                    }
                }
            }
            return(value);
        }
コード例 #5
0
 public SelfSolve(Cube _cube)
 {
     cube        = _cube;
     CubeState   = cube.cubeConfig;
     targetState = CubeState.GetCubeState();
 }
コード例 #6
0
 public int GetCubeValue(CubeConfig cubeState)
 {
     var state = cubeState.GetCubeState();
     int value = 0;
     for (int i = 0; i < state.Count; i++)
     {
         string[,] currentFace = state[i];
         string[,] targetFace = targetState[i];
         for (int x = 0; x < 3; x++)
         {
             for (int y = 0; y < 3; y++)
             {
                 if (currentFace[x, y] != targetFace[x, y])
                     value++;
             }
         }
     }
     return value;
 }
コード例 #7
0
 public SelfSolve(Cube _cube)
 {
     cube = _cube;
     CubeState = cube.cubeConfig;
     targetState = CubeState.GetCubeState();
 }