コード例 #1
0
        public String TestMembers(AIStateMachine current)
        {
            String result = FAIL;
            Console.WriteLine(SEP);
            Console.Write("Testing Machine Members for ");
            Console.WriteLine(current.GetName());

            Console.WriteLine("1) Machine State Names:");
            try
            {
                foreach (AIState state in current.GetStateNames())
                {
                    Console.WriteLine(state.ToString());
                }
            }
            catch (SystemException exc)
            {
                Console.WriteLine(exc.ToString());
                Console.Write("Machine State Names Test ");
                return FAIL;
            }

            Console.WriteLine("2) Machine Current State:");
            Console.WriteLine(current.GetCurrentState().ToString());

            Console.WriteLine("2) Machine State Vectors:");

            try
            {
                foreach (AIState state in current.GetStateNames())
                {
                    Double[] pvector = new Double[current.GetStateNames().Count()];
                    pvector = current.GetPVector(state);
                    Console.Write(state.ToString() + ": ");
                    PrintProbVector(pvector);

                }
            }
            catch (SystemException exc)
            {
                Console.WriteLine(exc.ToString());
                Console.Write("Machine PVector Test ");
                return FAIL;
            }

            result = PASS;
            return result;
        }
コード例 #2
0
        public String TestRemoveState(AIStateMachine current, AIState state)
        {
            String result = PASS;
            int oldNum;

            Console.WriteLine(SEP);
            Console.WriteLine("Testing RemoveState " + current.GetName() + " " + state.ToString());

            try
            {
                oldNum = current.GetNumStates();
                current.RemoveState(state);
                if (current.GetNumStates() != (oldNum - 1))
                {
                    result = FAIL;
                }
            }
            catch (SystemException exc)
            {
                Console.WriteLine(exc.ToString());
                Console.WriteLine("Machine Remove State Test ");
                return FAIL;
            }

            foreach (AIState newState in current.GetStateNames())
            {
                Console.WriteLine(newState.ToString() + "P Vector Test: "
                    + AIStateMachine.ValidVector(current.GetPVector(newState)));
            }

            return result;
        }
コード例 #3
0
        public String TestGetNextState(AIStateMachine current, int limit)
        {
            String result = PASS;
            Console.WriteLine(SEP);
            Console.Write("Testing Get Next State ");
            Console.WriteLine(current.GetName());
            try
            {
                for (int transition = 0; transition < limit; transition++)
                {
                    Console.WriteLine(current.GetNextState().ToString());
                }
            }
            catch (SystemException exc)
            {
                Console.WriteLine(exc.ToString());
                Console.Write("Machine GetNextState Test ");
                return FAIL;
            }

            return result;
        }