Пример #1
0
        public int TestAlgorithm(params string[] ids)
        {
            var scanner  = new InventoryScanner();
            var checksum = scanner.Checksum(ids);

            return(checksum);
        }
Пример #2
0
        public void FindSolutionToPart1()
        {
            var box = new List <string>();

            using (var stream = new FileStream("day2/input.txt", FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                var reader = new StreamReader(stream);

                while (!reader.EndOfStream)
                {
                    var line = reader.ReadLine();
                    box.Add(line);
                }
            }

            var scanner  = new InventoryScanner();
            var checksum = scanner.Checksum(box.ToArray());

            Console.WriteLine(checksum);
        }
Пример #3
0
        public void FindSolutionToPart2()
        {
            var box = new List <string>();

            using (var stream = new FileStream("day2/input.txt", FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                var reader = new StreamReader(stream);

                while (!reader.EndOfStream)
                {
                    var line = reader.ReadLine();
                    box.Add(line);
                }
            }

            var scanner = new InventoryScanner();
            var matches = scanner.FindPotentialMatches(box.ToArray());

            foreach (var match in matches)
            {
                Console.WriteLine(match);
            }
        }