예제 #1
0
        public static List <int> GetInputData()
        {
            var numbers = new List <int>();

            // Specify folder since it can be run from elsewhere, e.g. unittest
            string[] stringNumbers = InputDataHandler.ReadFileAsArray("../../../../AdventOfCode/DayOneInput.txt");

            foreach (string s in stringNumbers)
            {
                numbers.Add(Convert.ToInt32(s));
            }
            return(numbers);
        }
예제 #2
0
        public static List <PasswordPolicy> GetInputData()
        {
            var policies = new List <PasswordPolicy>();

            // Specify folder since it can be run from elsewhere, e.g. unittest
            string[] policyPasswordList = InputDataHandler.ReadFileAsArray("../../../../AdventOfCode/DayTwoInput.txt");

            foreach (string unparsed in policyPasswordList)
            {
                string[] policyAndPassword = unparsed.Split(':');
                policies.Add(new PasswordPolicy(policyAndPassword[0], policyAndPassword[1]));
            }
            return(policies);
        }