Beispiel #1
0
 private bool Check(List <State> C, Pos p)
 {
     for (int n = 0; n < C.Count; n++)
     {
         if (p.Compare(C[n].id) == true)
         {
             return(false);
         }
     }
     return(true);
 }
Beispiel #2
0
    private int GetMinIndexFromO(List <State> O, Pos end)
    {
        int   idx = 0;
        float v   = O[0].F;

        for (int n = 0; n < O.Count; n++)
        {
            if (end.Compare(O[n].id))
            {
                return(n);
            }

            if (v > O[n].F)
            {
                idx = n;
                v   = O[n].F;
            }
        }

        return(idx);
    }
Beispiel #3
0
    private void AddChildTree(List <State> C, ref TreeNode node, Pos end, int depth)
    {
        for (int n = 1; n < C.Count; n++)
        {
            if (C[n].parent.Compare(node.pos))
            {
                TreeNode t = new TreeNode(C[n].id, ref node);
                t.depth = depth;

                if (end.Compare(t.pos))
                {
                    if (leafNode == null || leafNode.depth > depth)
                    {
                        leafNode = t;
                    }
                }
                else
                {
                    AddChildTree(C, ref t, end, depth + 1);
                }
            }
        }
    }