private void CheckMap(Split split)
        {
            SplitMap splitMap = Utility.GetEnumValue <SplitMap>(split.Value);
            AreaType area     = AreaType.None;

            Enum.TryParse <AreaType>(splitMap.ToString(), true, out area);
            int completion = (int)Math.Floor(Memory.MapCompletion(area));

            ShouldSplit  = lastIntValue != (int)completion && completion == 100;
            lastIntValue = completion;
        }
示例#2
0
        private int StepsInShortestPathSplitMap(Dictionary <Point, char> map)
        {
            var splitMap   = new SplitMap(map);
            var totalSteps = 0;
            var allKeys    = map.Values.Where(char.IsLower).ToList();

            for (int robot = 0; robot < 4; robot++)
            {
                var start         = splitMap.Entrances[robot];
                var myKeys        = FindMyKeys(start, NeighborsKeysOnly, map);
                var startLocation = new LocationWithKey {
                    Location = start
                };
                foreach (var key in allKeys.Where(k => !myKeys.Contains(k)))
                {
                    startLocation.AddKey(key);
                }
                var terminationNode = BreadthFirst(new Node <LocationWithKey>(startLocation, 0), Neighbors, map, allKeys.Count);
                totalSteps += terminationNode.Depth;
            }

            return(totalSteps);
        }