Exemplo n.º 1
0
        static void Main(params string[] args)
        {
            // create environment with random state of cleaning.
            IEnvironment     env  = new VacuumEnvironment();
            IEnvironmentView view = new SimpleEnvironmentView();

            env.AddEnvironmentView(view);

            IAgent a = new ReflexVacuumAgent();

            env.AddAgent(a);
            env.Step(16);
            env.NotifyViews("Performance=" + env.GetPerformanceMeasure(a));
        }
        public void testCleanClean()
        {
            VacuumEnvironment tve = new VacuumEnvironment(
                    VacuumEnvironment.LocationState.Clean,
                    VacuumEnvironment.LocationState.Clean);
            tve.addAgent(agent, VacuumEnvironment.LOCATION_A);

            tve.AddEnvironmentView(new VacuumEnvironmentViewActionTracker(envChanges));

            tve.StepUntilDone();

            Assert.AreEqual("Action[name==Right]Action[name==NoOp]",
                    envChanges.ToString());
        }
Exemplo n.º 3
0
        public void testDirtyDirty()
        {
            VacuumEnvironment tve = new VacuumEnvironment(
                VacuumEnvironment.LocationState.Dirty,
                VacuumEnvironment.LocationState.Dirty);

            tve.addAgent(agent, VacuumEnvironment.LOCATION_A);

            tve.AddEnvironmentView(new VacuumEnvironmentViewActionTracker(envChanges));

            tve.Step(8);

            Assert.AreEqual(
                "Action[name==Suck]Action[name==Right]Action[name==Suck]Action[name==Left]Action[name==Right]Action[name==Left]Action[name==Right]Action[name==Left]",
                envChanges.ToString());
        }