public void Temp()
        {
            var detector = new MapFeatureDetector(mapIntArray);
            var conv     = MapFeatureDetector.ConvolveFilter(mapIntArray, FeatureFilters.NeighborCount);

            IterateMaps(detector, conv);
        }
        public void FloodFillTest()
        {
            var testArray = (int[, ])mapIntArray.Clone();

            MapFeatureDetector.AdamMilFill(testArray, 10, 9);
            Assert.AreEqual(1, testArray[10, 9]);
        }
        public void RegionTest()
        {
            var regionArray = MapFeatureDetector.GetRegions(mapIntArray);

            Debug.WriteLine(regionArray.ToRowString(asMap: true));
            Assert.AreEqual(3, regionArray[9, 12]);
            Assert.AreEqual(4, regionArray[14, 27]);
            Assert.AreEqual(2, regionArray[56, 23]);
        }
Example #4
0
        public void RegionTest()
        {
            var regionArray = MapFeatureDetector.GetRegions(mapIntArray);

            Debug.WriteLine(regionArray.ToRowString(asMap: true));
            Assert.AreEqual(3, regionArray[12, 9]);
            Assert.AreEqual(4, regionArray[27, 14]);
            Assert.AreEqual(2, regionArray[23, 56]);
        }
        public void FindDoorwaysTest()
        {
            var detector = new MapFeatureDetector(mapIntArray);
            var doorways = detector.FindDoorways();

            Debug.WriteLine(detector.ToMapString(doorways));

            Assert.AreEqual(2, doorways[19, 21]);
            Assert.AreEqual(3, doorways[29, 28]);
            Assert.AreEqual(4, doorways[34, 24]);
            Assert.AreEqual(0, doorways[23, 43]);
        }
        private static void IterateMaps(MapFeatureDetector detector, int[,] conv)
        {
            var min = conv.Min();
            var max = conv.Max();

            for (int i = min; i <= max; i++)
            {
                var splats = detector.FilterArray(conv, i);
                if (splats.Total() > 0)
                {
                    Debug.WriteLine(i);
                    Debug.WriteLine(detector.ToMapString(splats));
                }
            }
        }
        public void FindWallsTest()
        {
            var detector = new MapFeatureDetector(mapIntArray);
            var walls    = detector.FindWalls();

            Debug.WriteLine(detector.ToMapString(walls));
            Assert.AreEqual(1, walls[12, 45]);
            Assert.AreEqual(1, walls[12, 27]);
            Assert.AreEqual(1, walls[13, 27]);
            Assert.AreEqual(1, walls[14, 27]);
            Assert.AreEqual(1, walls[20, 34]);
            Assert.AreEqual(1, walls[8, 30]);
            Assert.AreEqual(1, walls[8, 31]);
            Assert.AreEqual(1, walls[8, 32]);
            Assert.AreEqual(1, walls[8, 33]);
            Assert.AreEqual(1, walls[8, 34]);
            Assert.AreEqual(1, walls[8, 35]);
        }
 public void ConstructorTest()
 {
     var detector = new MapFeatureDetector(mapIntArray);
 }
 public void GetApproximateRoomCenter()
 {
     var regions      = MapFeatureDetector.GetRegions(mapIntArray);
     var approxCenter = MapFeatureDetector.GetApproximateRoomCenter(regions, 2);
 }