public Benchmarks() { Day14 = new Day14(); Day15 = new Day15(); Day16 = new Day16(); (console, _, _) = VirtualConsole.CreateBuffered(); }
public void Stars() { var run = new Day15(); Assert.Equal("959", run.Result1()); // Assert.Equal("116590", run.Result2()); // Skipped for performance reasons }
public void SilverWorks() { Assert.Equal( new int[] { 0, 3, 6, 0, 3, 3, 1, 0, 4, 0 }, Day15.Play("0,3,6").Take(10).ToArray()); Assert.Equal(436, Day15.Play("0,3,6").ElementAt(2019)); }
public void Part2RealPuzzle() { var input = GetPuzzleInput(); var result = Day15.SolvePart2(input.SeedA, input.SeedB, 5000000); Assert.Equal(298, result); }
public void CanDoStepsForFiveRound() { var input = @"######### #G..G..G# #.......# #.......# #G..E..G# #.......# #.......# #G..G..G# #########"; var day = new Day15(input); day.DoRound(); day.DoRound(); day.DoRound(); day.DoRound(); day.DoRound(); Assert.Equal(2, day.Goblins[0].Y); Assert.Equal(4, day.Goblins[1].X); Assert.Equal(2, day.Goblins[1].Y); Assert.Equal(2, day.Goblins[2].Y); Assert.Equal(3, day.Goblins[3].X); Assert.Equal(4, day.Elves[0].X); Assert.Equal(3, day.Elves[0].Y); Assert.Equal(5, day.Goblins[4].X); Assert.Equal(4, day.Goblins[5].Y); Assert.Equal(4, day.Goblins[6].Y); Assert.Equal(5, day.Goblins[7].Y); }
static void Main(string[] args) { Day15 day15 = new Day15(); //day15.Part1(); day15.Part2(); }
public void Part1RealPuzzle() { var input = GetPuzzleInput(); var result = Day15.SolvePart1(input.SeedA, input.SeedB, 40000000); Assert.Equal(569, result); }
public void Part2() { var day15 = new Day15(); var actual = day15.CountMatches2(65, 8921); Assert.Equal(309, actual); }
public void Part2_Answer() { var day15 = new Day15(); var actual = day15.CountMatches2(591, 393); Assert.Equal(290, actual); }
public void Part1() { var day15 = new Day15(); var actual = day15.CountMatches(65, 8921); Assert.Equal(588, actual); }
public void CompareValues(long lhs, long rhs, bool expected) { var day15 = new Day15(); var actual = day15.Compare(lhs, rhs); Assert.Equal(expected, actual); }
public void Get5th() { var day15 = new Day15(); var actual = day15.GeneratorA(65).Where(a => a % 4 == 0).Take(5).Last(); Assert.Equal(740335192, actual); }
public void Day15() { var day = new Day15(); Assert.Equal(650, day.FirstPart()); Assert.Equal(336, day.SecondPart()); }
public void TestPartOneSample() { string input = "Disc #1 has 5 positions; at time=0, it is at position 4.\n" + "Disc #2 has 2 positions; at time=0, it is at position 1."; Assert.Equal(5, Day15.PartOne(input.Split("\n"))); }
public void CanSolve(string[] data, int count, int expected) { var day = new Day15(); var result = day.Solve(data, count); Assert.Equal(expected, result); }
public void PartATests(string input, int expectedOutput) { var day = new Day15(); var result = day.SolveA(input); Assert.AreEqual(expectedOutput, result); }
static void Main(string[] args) { IAoC day15 = new Day15(); Console.WriteLine(day15.PartA()); Console.WriteLine(day15.PartB()); }
public void CanGetLesserRisk(int i, int j, int expected) { var d = new Day15(riskmap); var risk = d.GetMinimumRiskUntil(i, j); risk.Should().Be(expected); }
public void Part2(string input, int expected) { var day = new Day15(); var actual = day.Part2(input); Assert.Equal(expected, actual); }
public void NextValue_A(long previous, long expected) { var day15 = new Day15(); var actual = day15.NextValue(previous, 16807); Assert.Equal(expected, actual); }
public void Day15Test5() { var result = Day15.ProcessGame("TestFiles/Day15/Test5.txt"); Assert.AreEqual(54, result.fullyFinishedRounds); Assert.AreEqual(536, result.totalHitpoints); }
public void GetDay15Part02AnswerTest() { int expected = 3718541; int actual = Day15.GetDay15Part02Answer(); Assert.Equal(expected, actual); }
public void GetDay15Part01AnswerTest() { int expected = 1428; int actual = Day15.GetDay15Part01Answer(); Assert.Equal(expected, actual); }
public void SolvePart2(string file, int expected) { day15 = new Day15(file); var actual = day15.SolvePart2( ); Assert.AreEqual(expected.ToString( ), actual); }
public void Day15Test7() { var result = Day15.ProcessGame("Day15/Input.txt"); Assert.AreEqual(82, result.fullyFinishedRounds); Assert.AreEqual(2606, result.totalHitpoints); }
public void Solve2() { const string input = "14,8,16,0,1,17"; var solver = new Day15(); var result = solver.Solve(input, 30000000); Output.WriteLine(result.ToString()); }
public void Part1() { const string input = "0,3,6"; var solver = new Day15(); var result = solver.Solve(input, 2020); result.ShouldBe(436); }
public void Day15Test8() { var result = Day15.ProcessGame("Day15/Input.txt", 23); Assert.AreEqual(37, result.fullyFinishedRounds); Assert.AreEqual(1424, result.totalHitpoints); Assert.IsFalse(result.anyElfDied); }
public void Day15Test6() { var result = Day15.ProcessGame("TestFiles/Day15/Test6.txt", 34); Assert.AreEqual(30, result.fullyFinishedRounds); Assert.AreEqual(38, result.totalHitpoints); Assert.IsFalse(result.anyElfDied); }
private static void DayMain(Day15 day, IServiceProvider services, ILogger <Program> logger) { //day.Run1(); //logger.LogInformation("\nShip is now at: \n\tX: \n\t{X} \n\tY: {Y} \n\tFacing: {Direction}\n\n\tDistance from start: {DistanceFromStart}", day.Ship.X, day.Ship.Y, day.Ship.Direction, day.DistanceFromStart); //day.Run2(); //logger.LogInformation("\nShip is now at: \n\tX: \n\t{X} \n\tY: {Y} \n\tFacing: {Direction}\n\n\tDistance from start: {DistanceFromStart}", day.Ship.X, day.Ship.Y, day.Ship.Direction, day.DistanceFromStart); }
public void Day15_Part2_Examples() { var d = new Day15(); var expected = 57600000; var actual = d.SolutionPart2( "Butterscotch: capacity -1, durability -2, flavor 6, texture 3, calories 8", "Cinnamon: capacity 2, durability 3, flavor -2, texture -1, calories 3"); Assert.AreEqual(expected, actual); }
public void Day15_Part2_Solution() { var d = new Day15(); var input = FileHelper.ReadTestFile(15); Assert.IsNotNull(input); var expected = 117936; var actual = d.SolutionPart2(input); Assert.AreEqual(expected, actual); }