Beispiel #1
0
        private static void ParseInput(string[] lines, FloorPlan floorPlan, List <VisitNode> placesToVisit)
        {
            for (int y = 0; y < lines.Length; y++)
            {
                string line = lines[y];
                for (int x = 0; x < line.Length; x++)
                {
                    switch (line[x])
                    {
                    case '.':
                        // do nothing
                        break;

                    case '#':
                        floorPlan.RecordObstruction(x, y);
                        break;

                    default:
                        int       positionSeq = Convert.ToInt32(line[x].ToString());
                        VisitNode place       = new VisitNode();
                        place.IsStartPosition = positionSeq == 0;
                        place.PositionNumber  = positionSeq;
                        place.XPosition       = x;
                        place.YPosition       = y;
                        placesToVisit.Add(place);
                        break;
                    }
                }
            }
        }