public override void Puzzle2() { SeatingSystem Seats = new SeatingSystem(input); Seats.LoopUpdateSeating(true); Console.WriteLine($"We have counted {Seats.CountOccupiedSeats()} occupied seats."); }
public void Day11_SeatingSystem_Example1_Part2_OK() { var sut = new SeatingSystem(testSeating); Assert.Equal(10, sut.Rows); Assert.Equal(10, sut.RowSize); Assert.Equal(0, sut.Now); Assert.False(sut.Compare()); Assert.Equal(0, sut.CountOccupiedSeats(sut.Now)); int seats = 0; bool areEqual = false; do { sut.CalcNextRound(true); areEqual = sut.Compare(); sut.DumpGenerations(); sut.Toggle(); seats = sut.CountOccupiedSeats(sut.Now); } while (!areEqual); Assert.Equal(26, seats); }
public void SightSeeing(int variant, string point, int expected) { var layout = CreateLayout(variant); var at = Point.FromString(point); var actual = SeatingSystem.CountSightOccupied(layout, at); Assert.Equal(expected, actual); }
public void PuzzleOne() { // Arrange var input = CreateLayout(0); // Act var actual = SeatingSystem.Stabilize(input); // Assert Assert.Equal(37, actual); }
public void PuzzleTwo() { // Arrange var input = CreateLayout(0); // Act var actual = SeatingSystem.StabilizeSeeing(input); // Assert Assert.Equal(26, actual); }
public void PuzzlePartTwo() { // Arrange var input = File .ReadLines("tests/y2020/Day11.Input.txt") .ToLayout(); // Act var actual = SeatingSystem.StabilizeSeeing(input); // Assert Assert.Equal(2361, actual); }
public void CountSightEmpty() { var input = @" #.LL.LL.L# #LLLLLL.LL L.L.L..L.. LLLL.LL.LL L.LL.LL.LL L.LLLLL.LL ..L.L..... LLLLLLLLL# #.LLLLLL.L #.LLLLL.L#".ToLayout(); var actual = SeatingSystem.CountSightOccupied(input, new Point(2, 0)); Assert.Equal(1, actual); actual = SeatingSystem.CountSightOccupied(input, new Point(3, 0)); Assert.Equal(0, actual); }
public void Day11SeatingSystem_Part1_OK() { var lines = DailyDataUtilities.ReadLinesFromFile("Day11Data.txt"); Assert.Equal(94, lines.Length); var sut = new SeatingSystem(lines); Assert.False(sut.Compare()); Assert.Equal(0, sut.CountOccupiedSeats(sut.Now)); int seats = 0; bool areEqual = false; do { sut.CalcNextRound(); areEqual = sut.Compare(); //sut.DumpGenerations(); sut.Toggle(); seats = sut.CountOccupiedSeats(sut.Now); } while (!areEqual); Assert.Equal(2222, seats); }