示例#1
0
        public void setFireTwice()
        {
            Pyromaniac agent = new Pyromaniac(1, 1);

            //set fire to (1,2)
            (agent.GetNextAction(world)).Invoke(world);
            Assert.IsFalse(world.isClear(1, 2));
            Assert.AreEqual(agent.CurrentLocation, 2);
            Assert.AreEqual(agent.TotalCost, 0);

            //set fire to (2,3)
            (agent.GetNextAction(world)).Invoke(world);
            Assert.IsFalse(world.isClear(2, 3));
            Assert.AreEqual(agent.CurrentLocation, 3);
            Assert.AreEqual(agent.TotalCost, 0);
        }
示例#2
0
        public void stuck2()
        {
            world.SetFire(1, 2);
            Pyromaniac agent = new Pyromaniac(2, 1);

            for (int i = 0; i < 20; i++)
            {
                double lastCost = agent.TotalCost;
                (agent.GetNextAction(world)).Invoke(world);
                Assert.AreEqual(agent.CurrentLocation, 1);
            }
            Assert.AreEqual(agent.TotalCost, Costs.Instance.Epsilon * 10);
        }