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; }
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; }
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); }
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); }
public SelfSolve(Cube _cube) { cube = _cube; CubeState = cube.cubeConfig; targetState = CubeState.GetCubeState(); }
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; }
public SelfSolve(Cube _cube) { cube = _cube; CubeState = cube.cubeConfig; targetState = CubeState.GetCubeState(); }