public override void MainCalculation() { List <int> inputList = FileLines[0].Split(',').Select(int.Parse).ToList(); List <int> finalSignals = new List <int>(); for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { for (int k = 0; k < 5; k++) { for (int p = 0; p < 5; p++) { for (int l = 0; l < 5; l++) { int[] phaseSettings = new int[] { i, j, k, p, l }; if (phaseSettings.Count() == phaseSettings.Distinct().Count()) { Day5 day5 = new Day5(FileLines); int outputAmplifier1 = day5.Intcode(inputList, false, i, 0); int outputAmplifier2 = day5.Intcode(inputList, false, j, outputAmplifier1); int outputAmplifier3 = day5.Intcode(inputList, false, k, outputAmplifier2); int outputAmplifier4 = day5.Intcode(inputList, false, p, outputAmplifier3); int outputAmplifier5 = day5.Intcode(inputList, false, l, outputAmplifier4); finalSignals.Add(outputAmplifier5); } } } } } } Console.WriteLine("Highest Signal: " + finalSignals.Max()); }
private static void Main() { Console.WriteLine("Advent of Code 2019"); //Day1.Solve(); //Day2.Solve(); //Day3.Solve(); //Day4.Solve(); Day5.Solve(); Console.Read(); }
private static void Main(string[] args) { //Day 1 Console.WriteLine($"Result Day 1 (Part 1): {Day1.ExecutePart1()}"); Console.WriteLine($"Result Day 1 (Part 2): {Day1.ExecutePart2()}"); //Day 2 Console.WriteLine($"Result Day 2 (Part 1): {Day2.ExecutePart1()}"); Console.WriteLine($"Result Day 2 (Part 2): {Day2.ExecutePart2(19690720)}"); //Day 3 Console.WriteLine($"Result Day 3 (Part 1): {Day3.ExecutePart1()}"); Console.WriteLine($"Result Day 3 (Part 2): {Day3.ExecutePart2()}"); //Day 4 Console.WriteLine($"Result Day 4 (Part 1): {Day4.ExecutePart1(145852, 616942)}"); Console.WriteLine($"Result Day 4 (Part 2): {Day4.ExecutePart2(145852, 616942, 1)}"); //Day 5 Console.WriteLine($"Result Day 5 (Part 1): {Day5.ExecutePart1(1)}"); Console.WriteLine($"Result Day 5 (Part 2): {Day5.ExecutePart2(5)}"); //Day 6 Console.WriteLine($"Result Day 6 (Part 1): {Day6.ExecutePart1()}"); Console.WriteLine($"Result Day 6 (Part 2): {Day6.ExecutePart2()}"); //Day 7 Console.WriteLine($"Result Day 7 (Part 1): {Day7.ExecutePart1()}"); Console.WriteLine($"Result Day 7 (Part 2): {Day7.ExecutePart2()}"); //Day 8 Console.WriteLine($"Result Day 8 (Part 1): {Day8.ExecutePart1()}"); Console.WriteLine($"Result Day 8 (Part 2): {Day8.ExecutePart2()}"); //Day 9 Console.WriteLine($"Result Day 9 (Part 1): {Day9.ExecutePart1()}"); Console.WriteLine($"Result Day 9 (Part 2): {Day9.ExecutePart2()}"); }
static private bool LoadPuzzles(string option) { bool finish = false; switch (option) { case "1": Day1 day1 = new Day1(); day1.Execute(); break; case "2": Day2 day2 = new Day2(); day2.Execute(); break; case "3": Day3 day3 = new Day3(); day3.Execute(); break; case "4": Day4 day4 = new Day4(); day4.Execute(); break; case "5": Day5 day5 = new Day5(); day5.Execute(); break; case "6": Day6 day6 = new Day6(); day6.Execute(); break; case "7": Day7 day7 = new Day7(); day7.Execute(); break; case "8": Day8 day8 = new Day8(); day8.Execute(); break; case "9": Day9 day9 = new Day9(); day9.Execute(); break; case "10": Day10 day10 = new Day10(); day10.Execute(); break; case "11": Day11 day11 = new Day11(); day11.Execute(); break; case "12": Day12 day12 = new Day12(); day12.Execute(); break; case "13": Day13 day13 = new Day13(); day13.Execute(); break; case "14": Day14 day14 = new Day14(); day14.Execute(); break; case "q": case "Q": finish = true; break; } return(finish); }