public void SideHas9Squares(Side side) { var squares = MovablePosition.GetMovablePositionsForSide(side); Assert.Equal(8, squares.Length); // Center Assert.Equal(0, squares.Count(MovablePosition.IsCenter)); // Edges MovablePosition[] edges = squares.Where(MovablePosition.IsEdge).ToArray(); Assert.Equal(4, edges.Length); var adjacents = CubeGeometry.GetClockwiseAdjacentFaces(side); foreach (var adjacent in adjacents) { Assert.Contains(MovablePosition.Get(side, adjacent), edges); } // Corners MovablePosition[] corners = squares.Where(MovablePosition.IsCorner).ToArray(); Assert.Equal(4, corners.Length); for (int i = 0; i < 4; ++i) { Assert.Contains(MovablePosition.Get(side, adjacents[i] | adjacents[(i + 1) % 4]), corners); } }
static void Assert_SideIsSolved(Side side, Cube cube) { var positions = MovablePosition.GetMovablePositionsForSide(side); foreach (var pos in positions) { Assert.Equal(side, cube[pos]); } }
static Cube() { _solvedStickers = new Side[48]; foreach (var face in CubeGeometry.AllSides) { foreach (var pos in MovablePosition.GetMovablePositionsForSide(face)) { _solvedStickers[pos.Index] = face; } } }