namespace Day19; public record Data(IDictionary Rules, IList Parts) { public int Process() { var sum = 0; foreach (var part in Parts) { Console.WriteLine(part); var next = "in"; while (next != "A" && next != "R") { var rule = Rules[next]; next = rule.Apply(part); } if (next == "A") { sum += part.Total; Console.WriteLine("ACCEPTED"); Console.WriteLine(); } else { Console.WriteLine("REJECTED"); Console.WriteLine(); } } return sum; } }