Exemplo n.º 1
0
        public void basicGame2()
        {
            TravelWorld world = new TravelWorld();

            world.AddPlaces(2, 3, 4);
            world.AddWay(3, 2, 1);
            world.AddWay(3, 4, 1);
            world.AddWay(2, 4, 10);

            Human human = new Human(2);

            human.costs.Pickup = 2;
            human.costs.Fire   = 6;

            agent = new CompetetiveAgent(2, 4, human, 3, 10);
            agent.costs.Pickup = 2;
            agent.costs.Fire   = 6;

            world.AddPlayer(human);
            world.AddPlayer(agent);

            agent.GetNextAction(world)(world);
            Assert.AreEqual(3, agent.CurrentLocation);

            agent.GetNextAction(world)(world);
            Assert.AreEqual(4, agent.CurrentLocation);
        }
Exemplo n.º 2
0
        public void GoToDest(BaseTraveler agent)
        {
            TravelWorld world = new TravelWorld();

            world.AddPlaces(1, 2, 3, 4);
            world.AddWay(1, 2, 1);
            world.AddWay(3, 2, 1);
            world.AddWay(3, 4, 1);
            Assert.IsTrue((agent.GetNextAction(world)).Invoke(world));
            Assert.AreEqual(agent.CurrentLocation, 3);
            Assert.IsTrue((agent.GetNextAction(world)).Invoke(world));
            Assert.AreEqual(agent.CurrentLocation, 4);
        }
Exemplo n.º 3
0
        public void noOperation(BaseTraveler agent)
        {
            TravelWorld world = new TravelWorld();

            world.AddPlaces(1, 2, 3, 4);
            world.AddWay(1, 2, 1);
            world.AddWay(3, 2, 1);
            world.AddWay(3, 4, 1);
            world.SetFire(1, 2);
            double prevCost = agent.TotalCost;

            (agent.GetNextAction(world)).Invoke(world);
            Assert.AreEqual(agent.TotalCost - prevCost, Costs.Instance.Epsilon);
            Assert.AreEqual(agent.CurrentLocation, 2);
        }
Exemplo n.º 4
0
        public void GoToDestOnce(BaseTraveler agent)
        {
            TravelWorld world = new TravelWorld();

            world.AddPlaces(1, 2, 3, 4);
            world.AddWay(1, 2, 1);
            world.AddWay(3, 2, 1);
            world.AddWay(3, 4, 1);
            world.AddWay(2, 4, 20);

            double prevCost = agent.TotalCost;

            Assert.IsTrue((agent.GetNextAction(world)).Invoke(world));
            Assert.AreEqual(agent.TotalCost - prevCost, 20);
            Assert.AreEqual(agent.CurrentLocation, 4);
        }