public void ReturnCorrectResult_OnSimpleDungeon()
        {
            var textMap = new[]
            {
                "P #",
                "# #",
                "  P"
            };
            var expectedOwnersMap = new[]
            {
                "00#",
                "#0#",
                "111"
            };
            var expectedDistancesMap = new[]
            {
                "01#",
                "#2#",
                "210"
            };
            var expected = ParseMaps(expectedOwnersMap, expectedDistancesMap);

            var actual = RivalsTask.AssignOwners(Map.FromLines(textMap));

            AssertResult(expected, actual);
        }
        public void ReturnCorrectResult_OnEmptyDungeon_WithMultiplePlayers()
        {
            var textMap = new[]
            {
                "P P",
                "   ",
                "P P"
            };
            var expectedOwnersMap = new[]
            {
                "001",
                "001",
                "223"
            };
            var expectedDistancesMap = new[]
            {
                "010",
                "121",
                "010"
            };
            var expected = ParseMaps(expectedOwnersMap, expectedDistancesMap);

            var actual = RivalsTask.AssignOwners(Map.FromLines(textMap));

            AssertResult(expected, actual);
        }
        public void ReturnReuslt_WithCorrectOrder()
        {
            var textMap = new[]
            {
                "   ",
                " P ",
                "  P"
            };
            var expectedOwnersMap = new[]
            {
                "000",
                "000",
                "001"
            };
            var expectedDistancesMap = new[]
            {
                "212",
                "101",
                "210"
            };
            var expected = ParseMaps(expectedOwnersMap, expectedDistancesMap);

            var actual = RivalsTask.AssignOwners(Map.FromLines(textMap));

            AssertResult(expected, actual);
        }
        public void ReturnCorrectResult_WhenSomeCellsAreUnreachable()
        {
            var textMap = new[]
            {
                "P ",
                "##",
                "  "
            };
            var expectedOwnersMap = new[]
            {
                "00",
                "##",
                "  "
            };
            var expectedDistancesMap = new[]
            {
                "01",
                "##",
                "  "
            };
            var expected = ParseMaps(expectedOwnersMap, expectedDistancesMap);

            var actual = RivalsTask.AssignOwners(Map.FromLines(textMap));

            AssertResult(expected, actual);
        }
        public void ReturnCorrectResult_WhenNoPaths()
        {
            var textMap = new[]
            {
                "P#",
                "##",
                "#P"
            };
            var expectedOwnersMap = new[]
            {
                "0#",
                "##",
                "#1"
            };
            var expectedDistancesMap = new[]
            {
                "0#",
                "##",
                "#0"
            };
            var expected = ParseMaps(expectedOwnersMap, expectedDistancesMap);

            var actual = RivalsTask.AssignOwners(Map.FromLines(textMap));

            AssertResult(expected, actual);
        }
示例#6
0
 private void PlayLevels(Map[] maps)
 {
     mapStates = new Dictionary <Map, List <OwnedLocation> >();
     foreach (var map in maps)
     {
         mapStates[map] = RivalsTask.AssignOwners(map).ToList();
     }
 }