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


C# PrologContext.ProveAllWokenGoals方法代码示例

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


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

示例1: Prove

        internal override IEnumerable<CutState> Prove(object[] args, PrologContext context, ushort parentFrame)
        {
            object[] goal1Args = null;
            object[] goal2Args = null;
            object[] goal3Args = null;
            object[] goal4Args = null;
            object[] goal5Args = null;
            object[] goal6Args = null;
            object[] goal7Args = null;
            object[] goal8Args = null;

            var newVars = new LogicVariable[FreeVariables.Count];
            object[] newArgs = Term.AlphaConvertArglist(HeadArgs, FreeVariables, newVars, context, true);
            // ReSharper disable UnusedVariable
            foreach (bool ignore in Term.UnifyArraysFast(args, newArgs, context))
            {
                if (goal1Args == null)
                    goal1Args = Term.AlphaConvertArglist(BodyGoals[0].Arguments, FreeVariables, newVars, context, false);

                foreach (CutState ignoreFreeze in context.ProveAllWokenGoals())
                    // ReSharper restore UnusedVariable
                    foreach (CutState state1 in context.KnowledgeBase.Prove(BodyGoals[0].Functor, goal1Args, context, parentFrame))
                {
                    if (state1 == CutState.ForceFail) yield return CutState.ForceFail;
                    if (goal2Args == null)
                        goal2Args = Term.AlphaConvertArglist(BodyGoals[1].Arguments, FreeVariables, newVars, context, false);

                    foreach (CutState state2 in context.KnowledgeBase.Prove(BodyGoals[1].Functor, goal2Args, context, parentFrame))
                    {
                        if (state2 == CutState.ForceFail) yield return CutState.ForceFail;
                        if (goal3Args == null)
                            goal3Args = Term.AlphaConvertArglist(BodyGoals[2].Arguments, FreeVariables, newVars, context, false);

                        foreach (CutState state3 in context.KnowledgeBase.Prove(BodyGoals[2].Functor, goal3Args, context, parentFrame))
                        {
                            if (state3 == CutState.ForceFail) yield return CutState.ForceFail;
                            if (goal4Args == null)
                                goal4Args = Term.AlphaConvertArglist(BodyGoals[3].Arguments, FreeVariables, newVars, context, false);

                            foreach (CutState state4 in context.KnowledgeBase.Prove(BodyGoals[3].Functor, goal4Args, context, parentFrame))
                            {
                                if (state4 == CutState.ForceFail) yield return CutState.ForceFail;
                                if (goal5Args == null)
                                    goal5Args = Term.AlphaConvertArglist(BodyGoals[4].Arguments, FreeVariables, newVars, context, false);

                                foreach (CutState state5 in context.KnowledgeBase.Prove(BodyGoals[4].Functor, goal5Args, context, parentFrame))
                                {
                                    if (state5 == CutState.ForceFail) yield return CutState.ForceFail;
                                    if (goal6Args == null)
                                        goal6Args = Term.AlphaConvertArglist(BodyGoals[5].Arguments, FreeVariables, newVars, context, false);

                                    foreach (CutState state6 in context.KnowledgeBase.Prove(BodyGoals[5].Functor, goal6Args, context, parentFrame))
                                    {
                                        if (state6 == CutState.ForceFail) yield return CutState.ForceFail;
                                        if (goal7Args == null)
                                            goal7Args = Term.AlphaConvertArglist(BodyGoals[6].Arguments, FreeVariables, newVars, context, false);

                                        foreach (CutState state7 in context.KnowledgeBase.Prove(BodyGoals[6].Functor, goal7Args, context, parentFrame))
                                        {
                                            if (state7 == CutState.ForceFail) yield return CutState.ForceFail;
                                            if (goal8Args == null)
                                                goal8Args = Term.AlphaConvertArglist(BodyGoals[7].Arguments, FreeVariables, newVars, context, false);

                                            foreach (CutState state8 in context.KnowledgeBase.Prove(BodyGoals[7].Functor, goal8Args, context, parentFrame))
                                            {
                                                yield return state8;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
开发者ID:ianhorswill,项目名称:UnityProlog,代码行数:76,代码来源:KnowledgeBaseRule.cs


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