Beispiel #1
0
    void ReadFromFile(string filePath)
    {
        XElement xd = XElement.Load(filePath);

        foreach (XElement xel in xd.Elements())
        {
            ASM asm = new ASM();
            asm.name = xel.Attribute("name").Value;
            foreach (XElement childxel in xel.Elements())
            {
                CHILD child = new CHILD();
                child.name = childxel.Attribute("name").Value;
                foreach (XElement chprop in childxel.Elements())
                {
                    switch (chprop.Name.ToString())
                    {
                    case "translateFrom":
                        string[] transtring = chprop.Value.Split(' ');
                        child.translateFrom = new Vector3(ConvertToFloat(transtring[0]), ConvertToFloat(transtring[1]), ConvertToFloat(transtring[2]));
                        //Console.WriteLine("\t\tT " + chprop.Value);
                        break;

                    case "alphaFromTo":
                        string[] astring = chprop.Value.Split(' ');
                        child.alphaFromTo = new Vector2(ConvertToFloat(astring[0]), ConvertToFloat(astring[1]));
                        //Console.WriteLine("\t\tA " + chprop.Value);
                        break;

                    case "durationFrames":
                        child.durationFrames = ConvertToInt(chprop.Value);
                        //Console.WriteLine("\t\tD " + chprop.Value);
                        break;

                    case "extraInstruction":
                        child.extraInstruction = chprop.Value;
                        //Console.WriteLine("\t\tE " + chprop.Value);
                        break;

                    default:
                        Debug.LogError("error!");
                        break;
                    }
                }
                asm.childList.Add(child);
            }
            asmDict.Add(asm.name, asm);
        }
    }
Beispiel #2
0
        int select_best_uct(int color)
        {
            node_num = 0;
            int next     = create_node();
            int uct_loop = 1000;

            for (int i = 0; i < uct_loop; i++)
            {
                int[] board_copy = new int[BOARD_MAX];
                for (int j = 0; j < BOARD_MAX; j++)
                {
                    board_copy[j] = board[j];
                }
                int ko_z_copy = ko_z;
                search_uct(color, next);
                for (int j = 0; j < BOARD_MAX; j++)
                {
                    board[j] = board_copy[j];
                }
                ko_z = ko_z_copy;
            }
            int best_i = -1;
            int max    = -999;

            for (int i = 0; i < node[next].child_num; i++)
            {
                CHILD p_child = node[next].child[i];
                if (p_child.games > max)
                {
                    best_i = i;
                    max    = p_child.games;
                }
            }
            int ret_z = node[next].child[best_i].z;

            return(ret_z);
        }
 public bool IsNotHasSubject()
 {
     return(PARENT.IsSubsentNotHasSubject() && CHILD.IsSubsentNotHasSubject() && SUBSENT3.IsSubsentNotHasSubject());
 }