public void Day13_Part2_Solution() { var d = new Day13(); var input = FileHelper.ReadTestFile(13); Assert.IsNotNull(input); var expected = 725; var actual = d.SolutionPart2(input); Assert.AreEqual(expected, actual); }
public void Day13_Part1_Examples() { var d = new Day13(); var expected = 330; var actual = d.SolutionPart1( "Alice would gain 54 happiness units by sitting next to Bob.", "Alice would lose 79 happiness units by sitting next to Carol.", "Alice would lose 2 happiness units by sitting next to David.", "Bob would gain 83 happiness units by sitting next to Alice.", "Bob would lose 7 happiness units by sitting next to Carol.", "Bob would lose 63 happiness units by sitting next to David.", "Carol would lose 62 happiness units by sitting next to Alice.", "Carol would gain 60 happiness units by sitting next to Bob.", "Carol would gain 55 happiness units by sitting next to David.", "David would gain 46 happiness units by sitting next to Alice.", "David would lose 7 happiness units by sitting next to Bob.", "David would gain 41 happiness units by sitting next to Carol."); Assert.AreEqual(expected, actual); }
public void Part2RealPuzzle() { var result = Day13.SolvePart2(GetPuzzleInput()); Assert.Equal(3907470, result); }
public void Part1_simple_test1() { Assert.That(Day13.Part1(_simpleInput1), Is.EqualTo("7,3")); }
public void Part2() { var result = Day13.SolvePart2(_input); Assert.Equal(906332393333683, result); }
static void Main(string[] args) { Console.WriteLine("*** AdventOfCode2020 ***"); Console.WriteLine($"{Environment.NewLine}--- Day 1: Report Repair ---"); var day1 = new Day01(); ExecuteSolution("1.1", day1.ExecutePart1); ExecuteSolution("1.2", day1.ExecutePart2); var day2 = new Day02(); ExecuteSolution("2.1", day2.ExecutePart1); ExecuteSolution("2.2", day2.ExecutePart2); var day3 = new Day03(); ExecuteSolution("3.1", day3.ExecutePart1); ExecuteSolution("3.2", day3.ExecutePart2); var day4 = new Day04(); ExecuteSolution("4.1", day4.ExecutePart1); ExecuteSolution("4.2", day4.ExecutePart2); var day5 = new Day05(); ExecuteSolution("5.1", day5.ExecutePart1); ExecuteSolution("5.2", day5.ExecutePart2); var day6 = new Day06(); ExecuteSolution("6.1 Loop", day6.ExecutePart1); ExecuteSolution("6.1 Linq", day6.ExecutePart1Linq); ExecuteSolution("6.2 Loop", day6.ExecutePart2); ExecuteSolution("6.2 Linq", day6.ExecutePart2Linq); var day7 = new Day07(); ExecuteSolution("7.1", day7.ExecutePart1); ExecuteSolution("7.2", day7.ExecutePart2); var day8 = new Day08(); ExecuteSolution("8.1", day8.ExecutePart1); ExecuteSolution("8.2", day8.ExecutePart2); var day8Simpler = new Day08Simpler(); ExecuteSolution("8.1", day8Simpler.ExecutePart1); ExecuteSolution("8.2", day8Simpler.ExecutePart2); var day9 = new Day09(); ExecuteSolution("9.1", day9.ExecutePart1); ExecuteSolution("9.2", day9.ExecutePart2); var day10 = new Day10(); ExecuteSolution("10.1", day10.ExecutePart1); ExecuteSolution("10.2", day10.ExecutePart2); var day11 = new Day11(); ExecuteSolution("11.1", day11.ExecutePart1); ExecuteSolution("11.2", day11.ExecutePart2); var day12 = new Day12(); ExecuteSolution("12.1", day12.ExecutePart1); ExecuteSolution("12.2", day12.ExecutePart2); var day13 = new Day13(); ExecuteSolution("13.1", day13.ExecutePart1); ExecuteSolution("13.2", day13.ExecutePart2); var day14 = new Day14(); ExecuteSolution("14.1", day14.ExecutePart1); ExecuteSolution("14.2", day14.ExecutePart2); var day15 = new Day15(); ExecuteSolution("15.1", day15.ExecutePart1); ExecuteSolution("15.2", day15.ExecutePart2); var day16 = new Day16(); ExecuteSolution("16.1", day16.ExecutePart1); ExecuteSolution("16.2", day16.ExecutePart2); var day17 = new Day17(); ExecuteSolution("17.1", day17.ExecutePart1); ExecuteSolution("17.2", day17.ExecutePart2); var day18 = new Day18(); ExecuteSolution("18.1", day18.ExecutePart1); ExecuteSolution("18.2", day18.ExecutePart2); var day19 = new Day19(); ExecuteSolution("19.1", day19.ExecutePart1); ExecuteSolution("19.2", day19.ExecutePart2); var day21 = new Day21(); ExecuteSolution("21.1", day21.ExecutePart1); ExecuteSolution("21.2", day21.ExecutePart2); }
internal void Handle() { Day d = new Day(0); switch (selected + 1) { case 1: d = new Day1(GetPath("Day1-Part1.txt")); Console.WriteLine(String.Format("Result Part 1: {0}", d.Part1())); Console.WriteLine(String.Format("Result Part 2: {0}", d.Part2())); break; case 2: d = new Day2(GetPath("Day2-Part1.txt")); Console.WriteLine(String.Format("Result Part 1: {0}", d.Part1())); Console.WriteLine(String.Format("Result Part 2: {0}", d.Part2())); break; case 3: d = new Day3(GetPath("Day3-Part1.txt")); Console.WriteLine(String.Format("Result Part 1: {0}", d.Part1Long())); Console.WriteLine(String.Format("Result Part 2: {0}", d.Part2Long())); break; case 4: d = new Day4(GetPath("Day4-Part1.txt")); Console.WriteLine(String.Format("Result Part 1: {0}", d.Part1())); Console.WriteLine(String.Format("Result Part 2: {0}", d.Part2())); break; case 5: d = new Day5(GetPath("Day5-Part1.txt")); Console.WriteLine(String.Format("Result Part 1: {0}", d.Part1())); Console.WriteLine(String.Format("Result Part 2: {0}", d.Part2())); break; case 6: d = new Day6(GetPath("Day6-Part1.txt")); Console.WriteLine(String.Format("Result Part 1: {0}", d.Part1())); Console.WriteLine(String.Format("Result Part 2: {0}", d.Part2())); break; case 7: d = new Day7(GetPath("Day7-Part1.txt")); Console.WriteLine(String.Format("Result Part 1: {0}", d.Part1())); Console.WriteLine(String.Format("Result Part 2: {0}", d.Part2())); break; case 8: d = new Day8(GetPath("Day8-Part1.txt")); Console.WriteLine(String.Format("Result Part 1: {0}", d.Part1())); Console.WriteLine(String.Format("Result Part 2: {0}", d.Part2())); break; case 9: d = new Day9(GetPath("Day9-Part1.txt"), 25); Console.WriteLine(String.Format("Result Part 1: {0}", d.Part1Long())); Console.WriteLine(String.Format("Result Part 2: {0}", d.Part2Long())); break; case 10: d = new Day10(GetPath("Day10-Part1.txt")); Console.WriteLine(String.Format("Result Part 1: {0}", d.Part1())); Console.WriteLine(String.Format("Result Part 2: {0}", d.Part2Long())); break; case 11: d = new Day11(GetPath("Day11-Part1.txt")); Console.WriteLine(String.Format("Result Part 1: {0}", d.Part1())); Console.WriteLine(String.Format("Result Part 2: {0}", d.Part2())); break; case 12: d = new Day12(GetPath("Day12-Part1.txt")); Console.WriteLine(String.Format("Result Part 1: {0}", d.Part1())); Console.WriteLine(String.Format("Result Part 2: {0}", d.Part2())); break; case 13: d = new Day13(GetPath("Day13-Part1.txt")); Console.WriteLine(String.Format("Result Part 1: {0}", d.Part1Long())); Console.WriteLine(String.Format("Result Part 2: {0}", d.Part2Long())); break; } Console.WriteLine("Press any key to continue"); Console.ReadKey(); }
public void Puzzle1ExampleTest() { var crashSpace = Day13.Puzzle1(inputDay13Example1); Assert.AreEqual("7,3", crashSpace); }
public void Puzzle2ExampleTest() { var crashSpace = Day13.Puzzle2(inputDay13Example2); Assert.AreEqual("6,4", crashSpace); }
public void Day13_Part1(long part1) { var d = new Day13(); Assert.Equal(part1.ToString(), d.Part1()); }
public override void Execute() { string sample = ""; if (_options.Sample) { sample = "-sample"; } string filename = Path.Combine(Environment.CurrentDirectory, "..", "AdventOfCode.2019", "input", $"day{_options.Day.ToString("D2")}{sample}.txt"); switch (_options.Day) { case 1: Day01.Execute(filename); break; case 2: Day02.Execute(filename); break; case 3: Day03.Execute(filename); break; case 4: Day04.Execute(filename); break; case 5: Day05.Execute(filename); break; case 6: Day06.Execute(filename); break; case 7: Day07.Execute(filename); break; case 8: Day08.Execute(filename); break; case 9: Day09.Execute(filename); break; case 10: Day10.Execute(filename); break; case 11: Day11.Execute(filename); break; case 12: Day12.Execute(filename); break; case 13: Day13.Execute(filename); break; case 14: Day14.Execute(filename); break; case 15: Day15.Execute(filename); break; case 16: Day16.Execute(filename); break; case 17: Day17.Execute(filename); break; case 18: Day18.Execute(filename); break; case 19: Day19.Execute(filename); break; case 20: Day20.Execute(filename); break; case 21: Day21.Execute(filename); break; case 22: Day22.Execute(filename); break; case 23: Day23.Execute(filename); break; case 24: Day24.Execute(filename); break; case 25: Day25.Execute(filename); break; default: throw new ArgumentException($"Day {_options.Day} is outside the scope of Advent of Code.", "--day"); } }
public void Part1() { var result = Day13.SolvePart1(_input); Assert.Equal(751, result); }
public void Part2() { var result = Day13.SolvePart2(_input); Assert.NotEmpty(result); }
public void Part2_real_test() { Assert.That(Day13.Part2(_input), Is.EqualTo("116,25")); }
public void Part2_simple_test1() { Assert.That(Day13.Part2(_simpleInput2), Is.EqualTo("6,4")); }
public void Part1_real_test() { Assert.That(Day13.Part1(_input), Is.EqualTo("116,10")); }
public int Part2(string input) { var target = new Day13(); return(target.Part2(input)); }
public void TestSeat(string input, long expectedId) { Assert.Equal(expectedId, Day13.SolvePart2(input)); }
public void Setup( ) { day13 = new Day13(new List <string>()); }
public void DepartureInfoWorks() { var result = Day13.DepartureInfo(Utils.ReadInputLines("13-test")); Assert.Equal((59, 5, 295), result); }
public void Puzzle1Test() { var crashSpace = Day13.Puzzle1(inputDay13); Assert.AreEqual("80,100", crashSpace); }
public void Setup() { d = new Day13(Path.Combine(TestContext.CurrentContext.TestDirectory, "Resources", "Input", "Day13-Part1.txt")); }
public void Puzzle2Test() { var crashSpace = Day13.Puzzle2(inputDay13); Assert.AreEqual("16,99", crashSpace); }
public static void Main(string[] args) { Day1 day1 = new Day1(); day1.Run(); Day2 day2 = new Day2(); day2.Run(); Day3 day3 = new Day3(); day3.Run(); Day4 day4 = new Day4(); day4.Run(); Day5 day5 = new Day5(); day5.Run(); Day6 day6 = new Day6(); day6.Run(); Day7 day7 = new Day7(); day7.Run(); Day8 day8 = new Day8(); day8.Run(); Day9 day9 = new Day9(); day9.Run(); Day10 day10 = new Day10(); day10.Run(); Day11 day11 = new Day11(); day11.Run(); Day12 day12 = new Day12(); day12.Run(); Day13 day13 = new Day13(); day13.Run(); Day14 day14 = new Day14(); day14.Run(); Day15 day15 = new Day15(); day15.Run(); Day16 day16 = new Day16(); day16.Run(); Day17 day17 = new Day17(); day17.Run(); Day18 day18 = new Day18(); day18.Run(); Day19 day19 = new Day19(); day19.Run(); Day20 day20 = new Day20(); day20.Run(); Day21 day21 = new Day21(); day21.Run(); Day22 day22 = new Day22(); day22.Run(); Day23 day23 = new Day23(); day23.Run(); Day24 day24 = new Day24(); day24.Run(); Day25 day25 = new Day25(); day25.Run(); }
public void DotCount1Works() { Assert.Equal(17, Day13.DotCount(input).First()); Assert.Equal(16, Day13.DotCount(input).Skip(1).First()); }
public void Setup( ) { day13 = new Day13("day13test1"); }
public void Setup() { _day13 = new Day13(); }
public void Part2_WithExampleData_ShouldCalculate(string busIds, long expectedAnswer) { var result = Day13.SolvePart2(new[] { null, busIds }); Assert.Equal(expectedAnswer, result); }
public void Day13Part1() { var input = System.IO.File.ReadAllLines(@"Input\Day13Test.txt"); Assert.AreEqual(330, Day13.GetBestSeatingsGain(input, false)); }
public void Part1RealPuzzle() { var result = Day13.SolvePart1(GetPuzzleInput()); Assert.Equal(2160, result); }
public void Part2(string input, int output) { var result = Day13.Part2(input); Assert.True(result == output, $"Expected: {output}, Received: {result}"); }
public void Initialize() => _day13 = new Day13();