Advent of Code 2021 - Day 22

This topic is about Day 22 of the Advent of Code 2021.

We have a private leaderboard (shared with users of Erlang Forums):

https://adventofcode.com/2021/leaderboard/private/view/370884

The entry code is:
370884-a6a71927

Here is my solution:

1 Like
1 Like

Here’s mine

1 Like

I see you are using ranges :smiley: I don’t even understand properly what Range.disjoint? means. So I just wrote all the cases. It’s still short enough.

Anyway here is my version, I’m splitting cubes too : adventofcode/day_22.ex at main · lud/adventofcode · GitHub
It took a couple minutes to run, but when I removed all IO.inspect and other printouts, it runs in 23ms :slight_smile:

It’s very infortunate that max contains the letter “x” so instead of using xmax names I used xi and xo for minimum x and maximum x, respectively. (“i” as in “min” and “o” for omega :smiley: ).

I did absolutely enjoy today, especially that AHA moment that I got after coming up with a possible solution in my head. That said the cube splitting took a while to properly implement.