Пример #1
0
        public static void StarOne(string fileLocation = "PuzzleInputs/Day3.txt")
        {
            string input = File.ReadAllText(fileLocation);

            var chars = input.ToCharArray().ToList();

            var sm = new SantaMap();

            chars.ForEach(c => sm.AddHouse(c));

            Console.WriteLine("3A: Houses Visited: " + sm.visitedHouses.Count);
        }
Пример #2
0
        public static void StarTwo(string fileLocation = "PuzzleInputs/Day3.txt")
        {
            string input = File.ReadAllText(fileLocation);

            var chars = input.ToCharArray().ToList();

            var sm  = new SantaMap();
            var sm2 = new SantaMap();


            for (int i = 0; i < chars.Count; i += 2)
            {
                sm.AddHouse(chars[i]);
                sm2.AddHouse(chars[i + 1]);
            }

            var housesVisited = sm.visitedHouses.Union(sm2.visitedHouses).ToList();

            Console.WriteLine("3B: Houses Visited: " + housesVisited.Count);
        }