view day14.txt @ 22:ad73a2ff3d06

Implement Day 15 part 1 and all of Day 16 Hash implementation was trivial, but I skipped the rest for now. Day 16 part 1 approach works unchanged for part 2! Just needed to run repeatedly with different inputs.
author IBBoard <dev@ibboard.co.uk>
date Sat, 16 Dec 2023 14:42:06 +0000
parents 46fb65f2cb94
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?