annotate day3.txt @ 2:0f4991eca11a

Implement day 3
author IBBoard <dev@ibboard.co.uk>
date Sun, 03 Dec 2023 16:07:25 +0000
parents
children 1e16a25a9553
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 You and the Elf eventually reach a gondola lift station; he says the gondola lift will take you up to the water source, but this is as far as he can bring you. You go inside.
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 It doesn't take long to find the gondolas, but there seems to be a problem: they're not moving.
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 "Aaah!"
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 You turn around to see a slightly-greasy Elf with a wrench and a look of surprise. "Sorry, I wasn't expecting anyone! The gondola lift isn't working right now; it'll still be a while before I can fix it." You offer to help.
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 The engineer explains that an engine part seems to be missing from the engine, but nobody can figure out which one. If you can add up all the part numbers in the engine schematic, it should be easy to work out which part is missing.
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 The engine schematic (your puzzle input) consists of a visual representation of the engine. There are lots of numbers and symbols you don't really understand, but apparently any number adjacent to a symbol, even diagonally, is a "part number" and should be included in your sum. (Periods (.) do not count as a symbol.)
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 Here is an example engine schematic:
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 467..114..
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 ...*......
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 ..35..633.
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 ......#...
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 617*......
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 .....+.58.
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 ..592.....
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 ......755.
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 ...$.*....
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 .664.598..
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 In this schematic, two numbers are not part numbers because they are not adjacent to a symbol: 114 (top right) and 58 (middle right). Every other number is adjacent to a symbol and so is a part number; their sum is 4361.
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27
0f4991eca11a Implement day 3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 Of course, the actual engine schematic is much larger. What is the sum of all of the part numbers in the engine schematic?