예제 #1
0
        static void Main(string[] args)
        {
            var area1        = LoadInput("input.txt");
            var waitingArea1 = new WaitingArea(area1);

            PartOne(waitingArea1);

            var area2        = LoadInput("input.txt");
            var waitingArea2 = new WaitingArea(area2);

            PartTwo(waitingArea2);
        }
예제 #2
0
        private static void PartOne(WaitingArea waitingArea)
        {
            var seatingsChanged = false;
            var i = 0;

            do
            {
                seatingsChanged = waitingArea.ApplySeatingPartOne();
                i++;
            } while (seatingsChanged);

            System.Console.WriteLine($"Part one: {i} iterations, {waitingArea.SeatsTaken} seats taken");
        }
예제 #3
0
        static void Main(string[] args)
        {
            var lines = File.ReadAllLines("input.txt");

            var waitingArea = new WaitingArea();

            waitingArea.SetSeats(lines);
            waitingArea.SetAllAdjacentSeats();

            bool stateChanged = true;

            while (stateChanged)
            {
                stateChanged = waitingArea.NextRound();
            }

            int result = waitingArea.CountOccupiedSeats();
        }