static void Main(string[] args) { string order = File.ReadAllText(args[0]); Cups cups = new Cups(order); Part1(cups); cups = new Cups(order, 1000000); Part2(cups); }
static void Part1(Cups cups) { for (int i = 0; i < 100; ++i) { cups.Move(); } // zero based indexing Cup one = cups.Find(0); Console.WriteLine("Part 1: {0}", string.Join("", one.Labels().Select(label => label + 1).Skip(1))); }
static void Part2(Cups cups) { for (int i = 0; i < 10000000; ++i) { cups.Move(); } Cup one = cups.Find(0); long next0 = one.Next.Label + 1; long next1 = one.Next.Next.Label + 1; Console.WriteLine("Part 2: {0}", next0 * next1); }