當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。