Exemplo n.º 1
0
        public void StateSpaceToolsGetPlayerActionsCountUpdatePlanTest()
        {
            Plan  newPlan  = testPlan.Clone() as Plan;
            State newState = testPlan.Initial.Clone() as State;

            newPlan.Initial = newState.NewState(testPlan.Steps[0] as Operator, testProblem.Objects);
            newPlan.Steps.RemoveAt(0);
            List <Operator> actions = StateSpaceTools.GetPlayerActions(testDomain, testProblem, newPlan.Initial as State);

            Assert.AreEqual(2, actions.Count);
        }
Exemplo n.º 2
0
        public void StateSpaceToolsGetPlayerActionsTest()
        {
            List <Operator> testPlayerActions = new List <Operator>
            {
                new Operator
                (
                    new Predicate("move", new List <ITerm> {
                    new Term("arthur", true), new Term("woods", true), new Term("lake", true)
                }, true),
                    new List <IPredicate>
                {
                    new Predicate("at", new List <ITerm> {
                        new Term("arthur", true), new Term("woods", true)
                    }, true),
                    new Predicate("at", new List <ITerm> {
                        new Term("arthur", true), new Term("lake", true)
                    }, false),
                    new Predicate("character", new List <ITerm> {
                        new Term("arthur", true)
                    }, true),
                    new Predicate("alive", new List <ITerm> {
                        new Term("arthur", true)
                    }, true),
                    new Predicate("location", new List <ITerm> {
                        new Term("woods", true)
                    }, true),
                    new Predicate("location", new List <ITerm> {
                        new Term("lake", true)
                    }, true),
                    new Predicate("connected", new List <ITerm> {
                        new Term("lake", true), new Term("woods", true)
                    }, true),
                },
                    new List <IPredicate>
                {
                    new Predicate("at", new List <ITerm> {
                        new Term("arthur", true), new Term("woods", true)
                    }, false),
                    new Predicate("at", new List <ITerm> {
                        new Term("arthur", true), new Term("lake", true)
                    }, true),
                }
                )
            };
            List <Operator> computedPlayerActions = StateSpaceTools.GetPlayerActions(testDomain, testProblem, testState);

            Assert.AreEqual(testPlayerActions[0], computedPlayerActions[0]);
        }