Exemplo n.º 1
0
        public static void Task()
        {
            var dict = new Dictionary <string, Node>();

            foreach (var x in Core.values)
            {
                dict.Add(x[0], new Node(x[0], int.Parse(x[1])));
            }

            foreach (var x in Core.values)
            {
                for (int i = 2; i < x.Length; ++i)
                {
                    dict[x[0]].AddConnection(dict[x[i]]);
                }
            }

            var startingNode = dict[Day7_1.MotherProgram()];

            Correct(startingNode);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            try
            {
                foreach (string s in input)
                {
                    var x   = Regex.Replace(s, @"(\(|\)| ->|,)", "");      //Remove "(", ") ->" and "," from the main string so only values are left.
                    var inp = Regex.Split(x, @"\s+");                      //Create an array of said values.

                    values.Add(inp);                                       //Add them to the list of rearranged input.
                }

                Day7_1.Task();
                Day7_2.Task();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            Console.Read();
        }