當前位置: 首頁>>代碼示例>>C#>>正文


C# Variable.unify方法代碼示例

本文整理匯總了C#中YieldProlog.Variable.unify方法的典型用法代碼示例。如果您正苦於以下問題:C# Variable.unify方法的具體用法?C# Variable.unify怎麽用?C# Variable.unify使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在YieldProlog.Variable的用法示例。


在下文中一共展示了Variable.unify方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: rangeList

 static IEnumerable<bool> rangeList(int M, int N, Variable List)
 {
     if (M >= N)
     {
         foreach (bool l1 in List.unify(new ListPair(N, Atom.NIL)))
             yield return false;
     }
     else
     {
         Variable Tail = new Variable();
         foreach (bool l1 in rangeList(M + 1, N, Tail))
         {
             foreach (bool l2 in List.unify(new ListPair(M, Tail)))
                 yield return false;
         }
     }
 }
開發者ID:fgeraci,項目名稱:CS195-Core,代碼行數:17,代碼來源:Queens.cs

示例2: attack3

 static IEnumerable<bool> attack3(object X, object N, object Arg3)
 {
     Variable Y = new Variable();
     foreach (bool l in new ListPair(Y, new Variable()).unify(Arg3))
     {
         if ((int)YP.getValue(X) == (int)Y.getValue() + (int)YP.getValue(N))
             yield return false;
         if ((int)YP.getValue(X) == (int)Y.getValue() - (int)YP.getValue(N))
             yield return false;
     }
     Variable Ys = new Variable();
     Variable N1 = new Variable();
     foreach (bool l1 in new ListPair(new Variable(), Ys).unify(Arg3))
     {
         foreach (bool l2 in N1.unify((int)YP.getValue(N) + 1))
         {
             foreach (bool l3 in attack3(X, N1, Ys))
                 yield return false;
         }
     }
 }
開發者ID:fgeraci,項目名稱:CS195-Core,代碼行數:21,代碼來源:NaiveQueens.cs

示例3: queens3

 static IEnumerable<bool> queens3(object UnplacedQs, object SafeQs, Variable Qs)
 {
     ListPair UnplacedQsListPair = YP.getValue(UnplacedQs) as ListPair;
     if (UnplacedQsListPair != null)
     {
         Variable UnplacedQs1 = new Variable();
         Variable Q = new Variable();
         foreach (bool l1 in selectq(Q, UnplacedQsListPair, UnplacedQs1))
         {
             if (!(SafeQs is ListPair && hasAttack((int)Q.getValue(), (ListPair)SafeQs)))
             {
                 foreach (bool l2 in queens3(UnplacedQs1, new ListPair(Q, SafeQs), Qs))
                     yield return false;
             }
         }
     }
     else
     {
         foreach (bool l1 in Qs.unify(SafeQs))
             yield return false;
     }
 }
開發者ID:fgeraci,項目名稱:CS195-Core,代碼行數:22,代碼來源:Queens.cs

示例4: selectq

        static IEnumerable<bool> selectq(Variable X, ListPair Arg2, Variable Arg3)
        {
            foreach (bool l1 in X.unify(Arg2._arg1))
            {
                foreach (bool l2 in Arg3.unify(Arg2._arg2))
                    yield return false;
            }

            ListPair Arg2Tail = YP.getValue(Arg2._arg2) as ListPair;
            if (Arg2Tail != null)
            {
                Variable Zs = new Variable();
                foreach (bool l1 in selectq(X, Arg2Tail, Zs))
                {
                    foreach (bool l2 in Arg3.unify(new ListPair(Arg2._arg1, Zs)))
                        yield return false;
                }
            }
        }
開發者ID:fgeraci,項目名稱:CS195-Core,代碼行數:19,代碼來源:Queens.cs


注:本文中的YieldProlog.Variable.unify方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。