Exemple #1
0
        public bool CanReachAllSectors(SimpleMapSector fromSector)
        {
            var visited = new List <SimpleMapSector>();

            var sectorsTravelled = TravelSector(fromSector, visited);

            return(Sectors.Count == sectorsTravelled);
        }
Exemple #2
0
        private int TravelSector(SimpleMapSector start, ICollection <SimpleMapSector> visited)
        {
            if (visited.Contains(start))
            {
                return(0);
            }

            visited.Add(start);
            var traveled = 1;

            var links = WormholeIds.FindAll(w => w.FromSectorId == start.Id || w.ToSectorId == start.Id);

            foreach (var l in links)
            {
                traveled += TravelSector(Sectors[l.ToSectorId], visited);
            }

            return(traveled);
        }