コード例 #1
0
 static void Main(string[] args)
 {
     Demo1.Run();
     Demo2.Run();
     Demo3.Run();
     Demo4.Run();
     Demo5.Run();
 }
コード例 #2
0
        private static void SimpleScheduledCFGExpansion(string[] args)
        {
            Console.WriteLine("Starting demo3 (simple CFG expansion).");

            int numberOfExpansions = Int32.Parse(args[1]);

            for (int i = 0; i < numberOfExpansions; i++)
            {
                Demo3 demo       = new Demo3();
                uint  unitCount1 = demo.Blackboard.NumberOfUnits();
                Console.WriteLine("Number of units before execution = " + unitCount1);

                while (demo.Blackboard.Changed)
                {
                    demo.Blackboard.ResetChanged();
                    demo.GenerateTree.Execute();
                }

                /*
                 * For now not placing these in a separate controller or worrying about how to generalize if-then logic in controllers.
                 * May just want to keep it this way, where raw c# is used for more complicated controller logic.
                 * fixme: This would be easy to specify in a priority-based scheme: LinearizeTreeLeaves, CleanTree and the logic to print the linearized leaves would all
                 * be lower priority than the knowledge sources that build the tree. So they would only fire when the tree is complete.
                 * Even without waiting for reactive KSs, this could be done with scheduled KSs that are sorted by priority with a loop that goes through each of the
                 * KSs executing the first one whose precondition is satisfied then starting over again from the highest priority.
                 */
                demo.LinearizeTreeLeaves.Execute();
                demo.CleanTree.Execute();

                var sequenceQuery = from unit in demo.Blackboard.LookupUnits <Unit>()
                                    where unit.HasComponent <KC_Sequence>()
                                    select unit;

                Debug.Assert(sequenceQuery.Count() == 1);
                Unit sequence = sequenceQuery.First();
                foreach (Unit unit in sequence.GetSequence())
                {
                    Console.Write(unit.GetText() + " ");
                }
                Console.WriteLine();

                uint unitCount2 = demo.Blackboard.NumberOfUnits();

                Console.WriteLine("Number of units after execution = " + unitCount2);
                Console.WriteLine();
            }
        }
コード例 #3
0
ファイル: UCL_MarshalDemo.cs プロジェクト: tim099/UCL_Core
        public void Test()
        {
            /*
             * unsafe {
             *  m_Demo = new Demo();
             *  //m_Demo.TestArr = new sbyte[1];
             *  m_Demo.TestArr[0] = 37;
             *  m_Data = m_Demo.ToByteArray();
             *
             *  m_DemoTest = m_Demo.ToByteArray().ToStructure<Demo>();
             * }
             */
            var test = new Demo3();

            test.TestArr = new long[5];
            for (int i = 0; i < test.TestArr.Length; i++)
            {
                test.TestArr[i] = 37 + i * 5 + i * i * 2;
            }
            test.m_Vals = new ValT[3];
            for (int i = 0; i < test.m_Vals.Length; i++)
            {
                test.m_Vals[i] = new ValT();
            }
            test.m_F = Core.MathLib.UCL_Random.Instance.NextFloat(2.0f);
            Dictionary <string, int> dic = new Dictionary <string, int>();

            dic.Add("hii", 3);
            dic.Add("No QAQ", 142);
            Debug.LogWarning(dic.UCL_ToString());
            ET e = ET.b;

            Debug.LogWarning(e.UCL_ToString());
            int a = 17;

            Debug.LogWarning(a.UCL_ToString());
            Debug.LogWarning(test.UCL_ToString());

            Debug.LogWarning(test.GetMember("m_F").UCL_ToString());
            Debug.LogWarning(test.GetMember("m_Demo").UCL_ToString());
        }
コード例 #4
0
 private void Demo3_Click(object sender, RoutedEventArgs e)
 {
     Demo3.Show();
 }