Пример #1
0
        public static int Main(string[] args)
        {
            var inputs = GetInput();

            var listed = inputs.ToList();

            var parsed = inputs.Select((input, rowIndex) =>
                                       input.Select((key, colIndex) => FloorLocation.Parse(key, new Point(rowIndex, colIndex))
                                                    ).ToList()
                                       )
                         .ToList();

            var size      = GetFileContentInfo(listed);
            var maxRounds = 100;


            Console.WriteLine($"---------------{Environment.NewLine}--- Part #1 ---{Environment.NewLine}---------------");
            RunPartOne(parsed, maxRounds, size.width, size.height);
            PrintOutput(parsed, maxRounds);

            Reset(parsed);

            Console.WriteLine($"---------------{Environment.NewLine}--- Part #2 ---{Environment.NewLine}---------------");
            RunPartTwo(parsed, maxRounds, size.width, size.height);
            PrintOutput(parsed, maxRounds);


            return(0);
        }
Пример #2
0
        public static FloorLocation Parse(char value, Point position)
        {
            var newSpot = new FloorLocation()
            {
                IsSeat   = value.IsChair(),
                Position = position,
            };

            return(newSpot);
        }