Exemplo n.º 1
0
        public void TestNearestStation()
        {
            var algorithm   = new PastukhVitaliiAlgorithm();
            var map         = new Map();
            var stationPos  = new Position(3, 2);
            var stationPos2 = new Position(5, 2);
            var station1    = new EnergyStation()
            {
                Energy = 1234, Position = stationPos, RecoveryRate = 4
            };
            var station2 = new EnergyStation()
            {
                Energy = 1454, Position = stationPos2, RecoveryRate = 3
            };

            map.Stations.Add(station1);
            map.Stations.Add(station2);

            var robots = new List <Robot.Common.Robot>()
            {
                new Robot.Common.Robot()
                {
                    Energy = 200, Position = new Position(2, 2),
                }
            };

            Assert.AreEqual(algorithm.FindNearestFreeStation(robots[0], map, robots), station1.Position);
        }
Exemplo n.º 2
0
        public void TestFreeStationNull()
        {
            var algorithm = new PastukhVitaliiAlgorithm();
            var map       = new Map();

            map.Stations.Add(new EnergyStation()
            {
                Energy = 500, Position = new Position(7, 7)
            });
            var robots = new List <Robot.Common.Robot>()
            {
                new Robot.Common.Robot()
                {
                    Energy = 500, Position = new Position(7, 7)
                }
            };

            robots.Add(new Robot.Common.Robot()
            {
                Energy = 8000, Position = new Position(5, 5)
            });

            Assert.IsNull(algorithm.FindNearestFreeStation(robots[1], map, robots));
        }