view 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
line wrap: on
line source

--- Day 14: Parabolic Reflector Dish ---

Given movable objects (O) and stationary objects (#) with free space (.),
"tilt" the map to the top so that the movable objects slide to the top
of the map and then determine the total "load" - the sum of the number
of rows from the movable object to the bottom of the map.

Given:

O....#....
O.OO#....#
.....##...
OO.#O....O
.O.....O#.
O.#..O.#.#
..O..#O..O
.......O..
#....###..
#OO..#....

Sliding makes it:

OOOO.#.O..
OO..#....#
OO..O##..O
O..#.OO...
........#.
..#....#.#
..O..#.O.O
..O.......
#....###..
#....#....

The load calculation is:

OOOO.#.O.. 10
OO..#....#  9
OO..O##..O  8
O..#.OO...  7
........#.  6
..#....#.#  5
..O..#.O.O  4
..O.......  3
#....###..  2
#....#....  1

Which gives 136.

Given a huge map, what is the load?

--- Part 2 ---

Now we want to cycle them by shifting them all in a cycle north, west, south and east.

After 1 cycle:
.....#....
....#...O#
...OO##...
.OO#......
.....OOO#.
.O#...O#.#
....O#....
......OOOO
#...O###..
#..OO#....

After 2 cycles:
.....#....
....#...O#
.....##...
..O#......
.....OOO#.
.O#...O#.#
....O#...O
.......OOO
#..OO###..
#.OOO#...O

After 3 cycles:
.....#....
....#...O#
.....##...
..O#......
.....OOO#.
.O#...O#.#
....O#...O
.......OOO
#...O###.O
#.OOO#...O


What is the top load after 1,000,000,000 cycles?