public void notFollwingOrgPath()
        {
            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, 100);
            world.PutWater(1);
            world.SetFire(3, 4);
            world.PickupCost = 1;
            int goal = 4;
            //the path should be 2->1->2->3->4

            RealTimeAStarAgent agnet = new RealTimeAStarAgent(new OneFireHuristic(goal).Run, 2, goal, 3);

            Assert.IsTrue(agnet.GetNextAction(world)(world));
            Assert.AreEqual(1, agnet.CurrentLocation);

            world.StopFire(3, 4);

            Assert.IsTrue(agnet.GetNextAction(world)(world));
            Assert.AreEqual(2, agnet.CurrentLocation);

            Assert.IsTrue(agnet.GetNextAction(world)(world));
            Assert.AreEqual(3, agnet.CurrentLocation);

            Assert.IsTrue(agnet.GetNextAction(world)(world));
            Assert.AreEqual(4, agnet.CurrentLocation);
        }
Exemple #2
0
        public void SetFireTest()
        {
            TravelWorld world = new TravelWorld();

            world.AddPlaces(1, 2, 3);
            world.AddWay(1, 3, 1);
            world.SetFire(1, 3);
            world.StopFire(1, 3);
            Assert.IsTrue(world.isClear(1, 3));
        }