comparison day19.txt @ 28:5ba34a851816

Implement Day 19 workflows, skip part 2
author IBBoard <dev@ibboard.co.uk>
date Wed, 03 Jan 2024 11:34:54 +0000
parents
children
comparison
equal deleted inserted replaced
27:6b58ddfaed38 28:5ba34a851816
1 --- Day 19: Aplenty ---
2
3 Objects have three values - x, m, a and s.
4
5 There are a number of workflows, which have a name and a set of rules.
6 Each rule specifies a condition and the name of the next step.
7 The first step is "in". The last steps are "A" (accepted) and "R" (rejected).
8 Once it matches a rule in a workflow, no further rules in the workflow are evaluated.
9
10 The input is a set of workflows, a blank line, and a set of objects.
11
12 px{a<2006:qkq,m>2090:A,rfg}
13 pv{a>1716:R,A}
14 lnx{m>1548:A,A}
15 rfg{s<537:gd,x>2440:R,A}
16 qs{s>3448:A,lnx}
17 qkq{x<1416:A,crn}
18 crn{x>2662:A,R}
19 in{s<1351:px,qqz}
20 qqz{s>2770:qs,m<1801:hdj,R}
21 gd{a>3333:R,R}
22 hdj{m>838:A,pv}
23
24 {x=787,m=2655,a=1222,s=2876}
25 {x=1679,m=44,a=2067,s=496}
26 {x=2036,m=264,a=79,s=2244}
27 {x=2461,m=1339,a=466,s=291}
28 {x=2127,m=1623,a=2188,s=1013}
29
30
31 These five parts would go:
32
33 {x=787,m=2655,a=1222,s=2876}: in -> qqz -> qs -> lnx -> A
34 {x=1679,m=44,a=2067,s=496}: in -> px -> rfg -> gd -> R
35 {x=2036,m=264,a=79,s=2244}: in -> qqz -> hdj -> pv -> A
36 {x=2461,m=1339,a=466,s=291}: in -> px -> qkq -> crn -> R
37 {x=2127,m=1623,a=2188,s=1013}: in -> px -> rfg -> A
38
39 The sum of the sum of the x, m, a and s scores for the accepted parts is 19114.
40
41 --- Part Two ---
42
43 Each value can be in the range 1 to 4000. In the example input,
44 there are 167409079868000 combinations of values that would be accepted.
45 No information is given about what this means or how it is calculated.