
Today and yesterday are very different types of puzzles. This one is a variation on a staple of the AoC series: Conway's Game of Life.
T...
For further actions, you may consider blocking this person and/or reporting abuse
COBOL, Friday night means I had time to do both parts.
Bit late today as I had to do yesterday first, due to teaching commitments and just to tired to sit down at 10pm to work on it yesterday :-)
Anyway, my first solution, which I won't post here, was very (very) slow, using just lists. So after see looking at comments reddit replaced lists with Map, with the key being the 2D index, it worked out pretty well. Of course, it would have been a lost faster in Rust or C++, just to two arrays, one for the current step, and one for the next, updating in place, and simply switching each step. However I'm trying to do as many of these using Haskell, as most of my other days use Rust and C++ and it's been fun returning to Haskell after quite a while. I feel I've learnt a lot just over these last few days, which always sees like a good outcome. Enough chat, my solution:
This one went surprisingly well! Still really fast, which I'm loving. And I got to make some more involved macros, which is fun.
Day11.h:
Day11.c:
Oops, forgot to post yesterday. Pleased with how this one turned out, especially the unit tests.
python solution for both part 1 and 2
I used Haskell. Definitely not the most efficient or optimized solution:
As the seats don't move, one can probably optimize the code by precomputing the neighbouring or visible seats, but waiting for 4 seconds was not boring enough for me to try it. So, I just count the number of adjacent or visible seats for each seat and then update the seating map.

Part 1:
Part 2:
Lots of code in this one, TIL about creating my generative iterators in Rust. Made me feel smart :). Boring parsing code is redacted. Full stuff on: github.com/benwtrent/advent-of-cod...
Ruby. Initially assumed a toroidal grid and wasted a huge amount of time in the process. Part 1:
Part 2:
Well I had a little time while rewatching Buffy this evening with the kids and inspired by E. Choroba, I wrote a very (very) simple C++ program to generate an annimated GIF showing the process of set allocation. It uses the single header GIF library:
The input is a file which has the width and height on the first two lines, followed by the grid for each step. For example, the example given in the AOC description for today:
OOP in Ruby; I enjoyed writing this!
Hi guys!
I tried the problem with go.
Unfortunately I still have a runtime in total of round about 120ms.
Do you have any suggestions for a performance enhancement?
Best regards
My JavaScript walkthrough: