comparison day14.txt @ 21:46fb65f2cb94

Add Day 14 part 1 implementation If you look at columns and see "how far can this go" then the weight is just the sum of the partial triangle numbers of highest_weight to highest_weight minus number of rocks that can roll up to there. Part 2 seems to involve actually moving the rocks, though!
author IBBoard <dev@ibboard.co.uk>
date Sat, 16 Dec 2023 10:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
20:fac484765bc9 21:46fb65f2cb94
1 --- Day 14: Parabolic Reflector Dish ---
2
3 Given movable objects (O) and stationary objects (#) with free space (.),
4 "tilt" the map to the top so that the movable objects slide to the top
5 of the map and then determine the total "load" - the sum of the number
6 of rows from the movable object to the bottom of the map.
7
8 Given:
9
10 O....#....
11 O.OO#....#
12 .....##...
13 OO.#O....O
14 .O.....O#.
15 O.#..O.#.#
16 ..O..#O..O
17 .......O..
18 #....###..
19 #OO..#....
20
21 Sliding makes it:
22
23 OOOO.#.O..
24 OO..#....#
25 OO..O##..O
26 O..#.OO...
27 ........#.
28 ..#....#.#
29 ..O..#.O.O
30 ..O.......
31 #....###..
32 #....#....
33
34 The load calculation is:
35
36 OOOO.#.O.. 10
37 OO..#....# 9
38 OO..O##..O 8
39 O..#.OO... 7
40 ........#. 6
41 ..#....#.# 5
42 ..O..#.O.O 4
43 ..O....... 3
44 #....###.. 2
45 #....#.... 1
46
47 Which gives 136.
48
49 Given a huge map, what is the load?
50
51 --- Part 2 ---
52
53 Now we want to cycle them by shifting them all in a cycle north, west, south and east.
54
55 After 1 cycle:
56 .....#....
57 ....#...O#
58 ...OO##...
59 .OO#......
60 .....OOO#.
61 .O#...O#.#
62 ....O#....
63 ......OOOO
64 #...O###..
65 #..OO#....
66
67 After 2 cycles:
68 .....#....
69 ....#...O#
70 .....##...
71 ..O#......
72 .....OOO#.
73 .O#...O#.#
74 ....O#...O
75 .......OOO
76 #..OO###..
77 #.OOO#...O
78
79 After 3 cycles:
80 .....#....
81 ....#...O#
82 .....##...
83 ..O#......
84 .....OOO#.
85 .O#...O#.#
86 ....O#...O
87 .......OOO
88 #...O###.O
89 #.OOO#...O
90
91
92 What is the top load after 1,000,000,000 cycles?