AdventOfCode/2020/day11
Adam Millerchip 4955687b53 Gave up on zig 2020, restore just the elixir version 2022-11-27 15:58:41 +09:00
..
README Gave up on zig 2020, restore just the elixir version 2022-11-27 15:58:41 +09:00
day11part1.exs Gave up on zig 2020, restore just the elixir version 2022-11-27 15:58:41 +09:00
day11part2.exs Gave up on zig 2020, restore just the elixir version 2022-11-27 15:58:41 +09:00
input Gave up on zig 2020, restore just the elixir version 2022-11-27 15:58:41 +09:00

README

Day 11 Notes

+--------+
| Part 1 |
+--------+

$ elixir day11part1.exs
2238

Pretty simple brute force that just iterates the full grid, checking the surrounding
seats for each case.

The main point seemed to be that the state was calculated immediately, which means
we need to keep the original state around while building the new state.

+--------+
| Part 2 |
+--------+

$ elixir day11part2.exs
2013

Added check_visible_in_direction to check the full line of sight, rather than just the
adjacent squares, and converted occupied_adjacent to occupied_visible to take advantage
of the new function.


+------------------+
| Overall Thoughts |
+------------------+

Naive, kind of slow brute-force techniques today.

Could look into a more efficient solution, but I didn't find the problem that interesting
so will leave it here.

What's a nice way to track/visualise a coordinate grid in Elixir? 🤔

What's more interesting is how the input data is generated. How were the inputs generated that they
would become stable, and what's the relationship between parts 1 and 2 for the same data?