private void printFace(Face face) { Console.Write("\n{0}\n\n", FaceHandler.getCharValue(face)); Console.Write("{0} {1} {2}\n", getColor(face, LocationInFace.TOPLEFT), getColor(face, LocationInFace.TOP), getColor(face, LocationInFace.TOPRIGHT)); Console.Write("{0} {1}\n", getColor(face, LocationInFace.LEFT), getColor(face, LocationInFace.RIGHT)); Console.Write("{0} {1} {2}\n", getColor(face, LocationInFace.BOTTOMLEFT), getColor(face, LocationInFace.BOTTOM), getColor(face, LocationInFace.BOTTOMRIGHT)); }
public void testFaceGetOpposite() { Face myFace = Face.BOTTOM; Assert.AreEqual(Face.TOP, FaceHandler.getOpposite(myFace)); myFace = Face.FRONT; Assert.AreEqual(Face.BACK, FaceHandler.getOpposite(myFace)); myFace = Face.RIGHT; Assert.AreEqual(Face.LEFT, FaceHandler.getOpposite(myFace)); myFace = Face.TOP; Assert.AreEqual(Face.BOTTOM, FaceHandler.getOpposite(myFace)); myFace = Face.BACK; Assert.AreEqual(Face.FRONT, FaceHandler.getOpposite(myFace)); myFace = Face.LEFT; Assert.AreEqual(Face.RIGHT, FaceHandler.getOpposite(myFace)); }
public Boolean isRedundant(Rotation p_rotation) { Boolean l_returnValue = false; Face l_lastFace; Direction l_lastDirection; if (c_array.Count > 0) { l_lastFace = c_array[(c_array.Count - 1)].getFace(); l_lastDirection = c_array[c_array.Count - 1].getDirection(); // new rotation is opposite to previous if (c_array[c_array.Count - 1].getReverse().equals(p_rotation)) { l_returnValue = true; } // previous face was opposite and previous face greater then current face if ((p_rotation.getFace() == FaceHandler.getOpposite(l_lastFace) && ((int)l_lastFace > (int)p_rotation.getFace()))) { l_returnValue = true; } // two clockwise rotation of same face if ((p_rotation.getFace() == l_lastFace) && (l_lastDirection == Direction.CW) && (p_rotation.getDirection() == Direction.CW)) { l_returnValue = true; } //no three counter clockwise rotations if (c_array.Count > 1) { if ((p_rotation.getFace() == l_lastFace) && (l_lastDirection == Direction.CCW) && (p_rotation.getDirection() == Direction.CCW) && (c_array[c_array.Count - 2].getFace() == l_lastFace) && (l_lastDirection == Direction.CCW) && (c_array[c_array.Count - 2].getDirection() == Direction.CCW)) { l_returnValue = true; } } } else { l_returnValue = false; } return(l_returnValue); }
public void testFaceGetIntGetChar() { Face myFace = Face.BOTTOM; Assert.AreEqual(1, (int)myFace); Assert.AreEqual('D', FaceHandler.getCharValue(myFace)); myFace = Face.FRONT; Assert.AreEqual(4, (int)myFace); Assert.AreEqual('F', FaceHandler.getCharValue(myFace)); myFace = Face.RIGHT; Assert.AreEqual(2, (int)myFace); Assert.AreEqual('R', FaceHandler.getCharValue(myFace)); myFace = Face.TOP; Assert.AreEqual(0, (int)myFace); Assert.AreEqual('U', FaceHandler.getCharValue(myFace)); myFace = Face.BACK; Assert.AreEqual(5, (int)myFace); Assert.AreEqual('B', FaceHandler.getCharValue(myFace)); myFace = Face.LEFT; Assert.AreEqual(3, (int)myFace); Assert.AreEqual('L', FaceHandler.getCharValue(myFace)); }