Example #1
0
        //Example1
        public void CoperativeGame()
        {
            TravelWorld world = CommonWorld();

            Human human = CommonHuman();

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

            agent.costs = CommonCosts();

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

            //pickupwater
            agent.GetNextAction(world)(world);
            Assert.AreEqual(1, agent.CurrentLocation);
            Assert.IsTrue(!world.HaveWater(1));

            human.noOpertion(world);
            //drive to 3
            agent.GetNextAction(world)(world);
            Assert.AreEqual(3, agent.CurrentLocation);
            Assert.IsTrue(world.isClear(1, 3));

            human.drive(world, 3);

            Assert.AreEqual(3, agent.CurrentLocation);
            Assert.AreEqual(3, agent.TotalCost);
            Assert.AreEqual(1.05, human.TotalCost);
        }
Example #2
0
        private static BaseTraveler[] CooperativePlayers()
        {
            Human human = new Human(_humanStartLocation);

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

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

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