static void Main(string[] args)
        {
            FertileLandFinder fertileLandFinder = new FertileLandFinder();
            List <int>        fertileLands      = fertileLandFinder.FindFertileLandAreas();

            //Sort the fertile lands
            fertileLands.Sort();
            foreach (int fertileLand in fertileLands)
            {
                Console.WriteLine(fertileLand);
            }
        }
Ejemplo n.º 2
0
        public void BarrenLandAnalysisTest2()
        {
            List <int> result = new List <int>()
            {
                22816, 192608
            };

            FertileLandFinder fertileLandFinder = new FertileLandFinder();

            string[] coordSets = new string[] { "48 192 351 207", "48 392 351 407", "120 52 135 547", "260 52 275 547" };

            fertileLandFinder.ReadCoordinates(coordSets);

            fertileLandFinder.CreateTotalLand();

            fertileLandFinder.MarkBarrenLands();

            fertileLandFinder.GetConnectedFertileLands();

            List <int> fertileLand = fertileLandFinder.GetFertileAreaMap();

            Assert.IsTrue(result.Equals(fertileLand));
        }
Ejemplo n.º 3
0
        public void BarrenLandAnalysisTest1()
        {
            List <int> result = new List <int>()
            {
                116800, 116800
            };

            FertileLandFinder fertileLandFinder = new FertileLandFinder();

            string[] coordSets = new string[] { "0 292 399 307" };

            fertileLandFinder.ReadCoordinates(coordSets);

            fertileLandFinder.CreateTotalLand();

            fertileLandFinder.MarkBarrenLands();

            fertileLandFinder.GetConnectedFertileLands();

            List <int> fertileLand = fertileLandFinder.GetFertileAreaMap();

            Assert.IsTrue(result.Equals(fertileLand));
        }