当前位置: 首页>>代码示例>>C#>>正文


C# Face.GetEdge方法代码示例

本文整理汇总了C#中Face.GetEdge方法的典型用法代码示例。如果您正苦于以下问题:C# Face.GetEdge方法的具体用法?C# Face.GetEdge怎么用?C# Face.GetEdge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Face的用法示例。


在下文中一共展示了Face.GetEdge方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckEdgeOnFace

        private async Task CheckEdgeOnFace(CubeConfiguration<FaceColour> configuration, List<IRotation> solution, Face<FaceColour> checkFace, Edge frontEdge, Edge checkEdge, Face<FaceColour> frontFace, FaceType movementFace, bool reverseDirection = false, bool doubleMoves = false)
        {
            var numMoves = doubleMoves ? 2 : 1;
            var center = checkFace.GetEdge(m_layer, checkEdge).Centre();
            if (center == m_faceColour)
            {
                for (int i = 0; i <= 3; i++)
                {
                    if (frontFace.GetEdge(m_layer, frontEdge).Centre() == m_faceColour) break;

                    await CommonActions.ApplyAndAddRotation(Rotations.FrontClockwise, solution, configuration).ConfigureAwait(false);

                }

                var direction = !reverseDirection ? RotationDirection.Clockwise : RotationDirection.AntiClockwise;
                var rotation = numMoves == 1 ? Rotations.ByFace(movementFace, direction, m_layer) : Rotations.ByFaceTwice(movementFace, m_layer);
                await CommonActions.ApplyAndAddRotation(rotation, solution, configuration).ConfigureAwait(false);


                for (int i = 0; i <= 3; i++)
                {
                    if (frontFace.GetEdge(m_layer, frontEdge).Centre() != m_faceColour) break;

                    await CommonActions.ApplyAndAddRotation(Rotations.FrontClockwise, solution, configuration).ConfigureAwait(false);

                }

                direction = !reverseDirection ? RotationDirection.AntiClockwise : RotationDirection.Clockwise;
                rotation = numMoves == 1 ? Rotations.ByFace(movementFace, direction, m_layer) : Rotations.ByFaceTwice(movementFace, m_layer);
                await CommonActions.ApplyAndAddRotation(rotation, solution, configuration).ConfigureAwait(false);

            }
        }
开发者ID:EdwardSalter,项目名称:NCubeSolver,代码行数:33,代码来源:SingleFaceCrossSolver.cs

示例2: GetEdge_GivenANonEdgeValue_Throws

        public void GetEdge_GivenANonEdgeValue_Throws()
        {
            var face = new Face<int>(null, 2);

            Assert.Throws<ArgumentException>(() => face.GetEdge((Edge)99));
        }
开发者ID:EdwardSalter,项目名称:NCubeSolver,代码行数:6,代码来源:FaceTests.cs

示例3: CheckTopLayerForWhite

        private static async Task CheckTopLayerForWhite(CubeConfiguration<FaceColour> configuration, Face<FaceColour> face, FaceType faceType, ICollection<IRotation> solution)
        {
            if (face.GetEdge(Edge.Top).Centre() != FaceColour.White) return;
            var edge = FaceRules.EdgeJoiningFaceToFace(faceType, FaceType.Upper);

            var joiningColour = configuration.Faces[FaceType.Upper].GetEdge(edge).Centre();
            var faceWithJoiningColour = FaceRules.GetFaceOfColour(joiningColour, configuration);
            var relativePostion = FaceRules.RelativePositionBetweenFaces(faceWithJoiningColour, faceType);

            switch (relativePostion)
            {
                case RelativePosition.Same:
                    await CommonActions.ApplyAndAddRotation(Rotations.UpperClockwise, solution, configuration).ConfigureAwait(false);

                    await CheckTopLayerForWhite(configuration, configuration.Faces[FaceType.Left], FaceType.Left, solution).ConfigureAwait(false);

                    break;

                case RelativePosition.Right:
                    await CommonActions.ApplyAndAddRotation(Rotations.ByFace(faceType, RotationDirection.AntiClockwise), solution, configuration).ConfigureAwait(false);

                    await CommonActions.ApplyAndAddRotation(Rotations.ByFace(faceWithJoiningColour, RotationDirection.Clockwise), solution, configuration).ConfigureAwait(false);

                    await CommonActions.ApplyAndAddRotation(Rotations.ByFace(faceType, RotationDirection.Clockwise), solution, configuration).ConfigureAwait(false);

                    break;

                case RelativePosition.Opposite:
                    await CommonActions.ApplyAndAddRotation(Rotations.UpperClockwise, solution, configuration).ConfigureAwait(false);

                    await CheckTopLayerForWhite(configuration, configuration.Faces[FaceType.Left], FaceType.Left, solution).ConfigureAwait(false);

                    break;

                case RelativePosition.Left:
                    await CommonActions.ApplyAndAddRotation(Rotations.ByFace(faceType, RotationDirection.Clockwise), solution, configuration).ConfigureAwait(false);

                    await CommonActions.ApplyAndAddRotation(Rotations.ByFace(faceWithJoiningColour, RotationDirection.AntiClockwise), solution, configuration).ConfigureAwait(false);

                    await CommonActions.ApplyAndAddRotation(Rotations.ByFace(faceType, RotationDirection.AntiClockwise), solution, configuration).ConfigureAwait(false);

                    break;
            }
        }
开发者ID:EdwardSalter,项目名称:NCubeSolver,代码行数:44,代码来源:BottomCrossSolver.cs

示例4: CheckMiddleLayerForWhite

        private static async Task CheckMiddleLayerForWhite(CubeConfiguration<FaceColour> configuration, Face<FaceColour> face, FaceType faceType, ICollection<IRotation> solution)
        {
            if (face.GetEdge(Edge.Left).Centre() == FaceColour.White)
            {
                await MoveWhiteFromMiddleLayer(configuration, faceType, solution, RelativePosition.Left, Edge.Right, RotationDirection.Clockwise).ConfigureAwait(false);

            }
            if (face.GetEdge(Edge.Right).Centre() == FaceColour.White)
            {
                await MoveWhiteFromMiddleLayer(configuration, faceType, solution, RelativePosition.Right, Edge.Left, RotationDirection.AntiClockwise).ConfigureAwait(false);

            }
        }
开发者ID:EdwardSalter,项目名称:NCubeSolver,代码行数:13,代码来源:BottomCrossSolver.cs


注:本文中的Face.GetEdge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。