private void PopulateDoubleAndTripleFaceCubies(CubeFace face, ref HashSet <Cubie> cubies) { PositionMover faceMover = new PositionMover(face.GetSquares(0).First()); Func <RelativePosition, Position, Cubie> cubieCreator = _cubieCreators[face.FaceDirection]; do { faceMover.Move(1); cubies.Add(cubieCreator(faceMover.CurrentRelativePosition, faceMover.CurrentPosition)); }while (faceMover.CurrentRelativePosition != RelativePosition.OnPointOne); }
private void PopulateSingleFaceCubies(CubeFace face, ref HashSet <Cubie> cubies) { Square square = face.GetSquares(0).First(); HashSet <Position> allFacePositions = new HashSet <Position>(face.CubiePositions); allFacePositions.ExceptWith(square.PositionsInSquare); foreach (Position position in allFacePositions) { Cubie singleFacedCubie = null; switch (face.FaceDirection) { case RubiksDirection.Front: singleFacedCubie = new Cubie ( frontSide: _frontColor, backSide: null, rightSide: null, leftSide: null, upSide: null, downSide: null, postion: position ); break; case RubiksDirection.Back: singleFacedCubie = new Cubie ( frontSide: null, backSide: _backColor, rightSide: null, leftSide: null, upSide: null, downSide: null, postion: position ); break; case RubiksDirection.Up: singleFacedCubie = new Cubie ( frontSide: null, backSide: null, rightSide: null, leftSide: null, upSide: _upColor, downSide: null, postion: position ); break; case RubiksDirection.Down: singleFacedCubie = new Cubie ( frontSide: null, backSide: null, rightSide: null, leftSide: null, upSide: null, downSide: _downColor, postion: position ); break; case RubiksDirection.Left: singleFacedCubie = new Cubie ( frontSide: null, backSide: null, rightSide: null, leftSide: _leftColor, upSide: null, downSide: null, postion: position ); break; case RubiksDirection.Right: singleFacedCubie = new Cubie ( frontSide: null, backSide: null, rightSide: _rightColor, leftSide: null, upSide: null, downSide: null, postion: position ); break; default: break; } cubies.Add(singleFacedCubie); } }