示例#1
0
        //Example 2
        public void RivalsGame()
        {
            TravelWorld world = CommonWorld();

            Human human = CommonHuman();

            var agent = new CompetetiveAgent(1, 3, human, 2, 10);

            agent.costs = CommonCosts();

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

            //set fire to 2
            agent.GetNextAction(world)(world);
            Assert.AreEqual(2, agent.CurrentLocation);
            Assert.IsTrue(!world.isClear(2, 1));

            human.pickupWater(world);

            //set fire to 3
            agent.GetNextAction(world)(world);
            Assert.AreEqual(3, agent.CurrentLocation);
            Assert.IsTrue(!world.isClear(2, 3));

            human.drive(world, 3);

            Assert.AreEqual(3, agent.TotalCost - human.TotalCost);
        }
示例#2
0
        private static BaseTraveler[] RivalPlayers()
        {
            Human human = new Human(_humanStartLocation);

            human.Goal         = _humanGoal;
            human.costs.Pickup = _humanPickup;
            human.costs.Fire   = _humanStartFire;

            CompetetiveAgent agent = new CompetetiveAgent(_gameStartLocation, _gameGoal, human, 2, _horizon);

            agent.costs.Fire   = _GameStartFire;
            agent.costs.Pickup = _gamePickup;
            return(new BaseTraveler[] { human, agent });
        }