Example #1
0
        static void Main(string[] args)
        {
            // Doing a thing.
            var formatter = new RecordFormatter(new FileReader());
            var records   = formatter.FormatFile(@"C:\Dev\GitHub\AdventOfCode2020\Day4\Data\input", "\n\n", true).Select(s => new NorthPoleCredential(s));

            var validRecords = records.Where(r => r.Valid).Count();

            Console.WriteLine(validRecords);

            var extendedValidRecords = records.Where(r => r.ExtendedValidation).Count();

            Console.WriteLine(extendedValidRecords);
        }
Example #2
0
        /// <summary>
        /// TuringBusses.Cmd entry point
        /// </summary>
        /// <param name="args">Command line arguments (not used)</param>
        static void Main(string[] args)
        {
            var filePath  = "./input";
            var reader    = new FileReader();
            var formatter = new RecordFormatter(reader);
            var records   = formatter.FormatFile(filePath, "\n", true);

            var timeStamp = int.Parse(records.First());

            var scheduler = new BusScheduler(formatter);

            var product = scheduler.GetNextBusProduct(timeStamp, records.Skip(1).First());

            Console.WriteLine(product);

            var timeStamp2 = scheduler.WinContest(records.Skip(1).First());

            Console.WriteLine(timeStamp2);
        }