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); }
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"); }
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(); }