public PuzzleManager() { Solutions = new Dictionary <int, string>(); Day day1 = new Day1(); Solutions.Add(0, day1.Solution1); Solutions.Add(1, day1.Solution2); Day day2 = new Day2(); Solutions.Add(2, day2.Solution1); Solutions.Add(3, day2.Solution2); Day day3 = new Day3(); Solutions.Add(4, day3.Solution1); Solutions.Add(5, day3.Solution2); Day day4 = new Day4(); Solutions.Add(6, day4.Solution1); Solutions.Add(7, day4.Solution2); Day day5 = new Day5(); Solutions.Add(8, day5.Solution1); Solutions.Add(9, day5.Solution2); }
private static void Main(string[] args) { var watch = System.Diagnostics.Stopwatch.StartNew(); Console.WriteLine("Day 1:"); Console.WriteLine("---"); Console.Write("1.) "); watch.Restart(); Console.Write(Day1.RunPart1()); Console.WriteLine(" - " + watch.ElapsedMilliseconds + " ms"); Console.Write("2.) "); watch.Restart(); Console.Write(Day1.RunPart2()); Console.WriteLine(" - " + watch.ElapsedMilliseconds + " ms"); Console.WriteLine("---"); Console.WriteLine("Day 2:"); Console.WriteLine("---"); Console.Write("1.) "); watch.Restart(); Console.Write(Day2.RunPart1()); Console.WriteLine(" - " + watch.ElapsedMilliseconds + " ms"); Console.Write("2.) "); watch.Restart(); Console.Write(Day2.RunPart2()); Console.WriteLine(" - " + watch.ElapsedMilliseconds + " ms"); Console.WriteLine("---"); /* * long sum1 = 0; * long sum2 = 0; * * var watch = System.Diagnostics.Stopwatch.StartNew(); * * int num = 1000; * * for(int i = 0; i < num; ++i) * { * watch.Restart(); * Day1.Star1.Run(); * watch.Stop(); * var time1 = watch.ElapsedMilliseconds; * watch.Restart(); * Day1.Star2.Run(); * watch.Stop(); * var time2 = watch.ElapsedMilliseconds; * * sum1 += time1; * sum2 += time2; * } * * Console.WriteLine(sum1 / (float)num); * Console.WriteLine(sum2 / (float)num); */ }
static void Main(string[] args) { Calculate("Day 1 part 1", () => Day1.Part1(Inputs.Day1)); Calculate("Day 1 part 2", () => Day1.Part2(Inputs.Day1)); Calculate("Day 2 part 1", () => Day2.Part1(Inputs.Day2)); Calculate("Day 2 part 2", () => Day2.Part2(Inputs.Day2)); Calculate("Day 3 part 1", () => Day3.Part1(Inputs.Day3)); Calculate("Day 3 part 2", () => Day3.Part2(Inputs.Day3)); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Day 1 part 1 answer: " + Day1.PartOne()); Console.WriteLine("Day 1 part 2 answer: " + Day1.PartTwo()); Console.WriteLine(""); Console.WriteLine("Day 2 part 1 answer: " + Day2.PartOne()); Console.WriteLine("Day 2 part 2 answer: " + Day2.PartTwo()); Console.WriteLine(""); Console.WriteLine("Day 3 part 1 answer: " + Day3.PartOne()); Console.WriteLine("Day 3 part 2 answer: " + Day3.PartTwo()); }
static void Main(string[] args) { // The code provided will print ‘Hello World’ to the console. // Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app. var _continue = true; while (_continue) { Console.WriteLine("Please enter which day to run: "); var day = Console.ReadLine(); switch (day) { case "1": Day1 day1 = new Day1(); break; case "2": Day2 day2 = new Day2(); break; default: break; } Console.WriteLine("Would you like to go again?"); var again = Console.ReadLine().ToLower(); switch (again) { case "y": _continue = true; break; case "n": Console.WriteLine("Exiting..."); _continue = false; break; default: Console.WriteLine("Invalid input, exiting..."); _continue = false; break; } } Console.ReadLine(); // Go to http://aka.ms/dotnet-get-started-console to continue learning how to build a console app! }
private void btnDay2bThreaded_Click(object sender, EventArgs e) { Day2.Day2bThreaded(); }
private void btnDay2b_Click(object sender, EventArgs e) { Day2.Day2b(); }
static void Main(string[] args) { Day2.Run(); }