Example #1
0
        public void Initialize()
        {
            var input = "AB5, BC4, CD8, DC8, DE6, AD5, CE2, EB3, AE7";

            //string[] parsedInputs = input.Split(',');
            string[] parsedInputs = input.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var parsedInput in parsedInputs)
            {
                var link               = parsedInput.Trim();
                var startingStation    = stations.AddStation(link.Substring(0, 1));
                var destinationStation = stations.AddStation(link.Substring(1, 1));
                var distance           = int.Parse(link.Substring(2, 1));
                startingStation.AddAdjacentStation(destinationStation, distance);
            }
        }