コード例 #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);
        }
コード例 #2
0
 public void SetParams(BaseTraveler player1, BaseTraveler player2, int depth)
 {
     // _goal = goal;
     _depth   = depth;
     _player1 = player1;
     _player2 = player2;
 }
コード例 #3
0
ファイル: Simulator.cs プロジェクト: limonana/AI_Course
 public Simulator(TravelWorld world, params BaseTraveler[] agents)
 {
     _world     = world;
     _agents    = agents;
     _human     = agents[0];
     _gameAgent = agents[1];
 }
コード例 #4
0
ファイル: RivalsEval.cs プロジェクト: limonana/AI_Course
 public void SetParams(BaseTraveler player, BaseTraveler rival, int totalMoves)
 {
     _player = player;
     //_goal = goal;
     _totalMoves = totalMoves;
     _rival      = rival;
     //_rivalGoal = rivalGoal;
 }
コード例 #5
0
ファイル: GreedyTest.cs プロジェクト: limonana/AI_Course
        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);
        }
コード例 #6
0
ファイル: GreedyTest.cs プロジェクト: limonana/AI_Course
        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);
        }
コード例 #7
0
ファイル: GreedyTest.cs プロジェクト: limonana/AI_Course
        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);
        }
コード例 #8
0
ファイル: TravelWorld.cs プロジェクト: limonana/AI_Course
 internal void SetLocation(BaseTraveler player, int location)
 {
     _locations[player] = location;
 }
コード例 #9
0
ファイル: TravelWorld.cs プロジェクト: limonana/AI_Course
 public void AddPlayer(BaseTraveler player)
 {
     _locations.Add(player, player.CurrentLocation);
 }
コード例 #10
0
ファイル: NaturalEval.cs プロジェクト: limonana/AI_Course
 public NaturalEval(int goal, BaseTraveler player, int MaxMoves)
 {
     _goal     = goal;
     _player   = player;
     _MaxMoves = MaxMoves;
 }
コード例 #11
0
ファイル: BasicCuttof.cs プロジェクト: limonana/AI_Course
 public void SetParams(BaseTraveler player, int depth)
 {
     // _goal = goal;
     _depth  = depth;
     _player = player;
 }