Skip to content

edhinard/aoc25

Repository files navigation

Once the problem is solved, I take the time to review/rewrite the code, simplify/optimize it if possible, and comment it. I have added a GitHub workflow wich runs the ruff linter. This year, there's no in-house aoc.py module to help with input decoding. It doesn't really help, actually.

If you wish to use it, you must provide your own data file, name it input.txt (do not share it) and place it next to the corresponding script.

04:19:03 / 04:42:49

At first I didn't want to participate. But then when I saw that it only lasted 12 days, I decided to go for it.

00:16:30 / 00:23:14

First wake-up at 5:45 am. Getting back into good habits.

00:08:29 / 00:23:33

Some time was spent debugging the second part. Yes, The slice [:0] is not equivalent to [:]! The statement to find the largest value in the list, excluding the last ones becomes: max(ratings[:-i if i else None])

00:09:57 / 00:13:37

I am often wrong, but this time I correctly guessed what the statement of the second part would be after reading the first. I had to find a different name for the variable containing the map of the printing department in order to comply with rule A001: use grid[row][col] instead of map[row][col].

00:06:16 / 00:19:41

Nothing complicated so far. Which doesn't stop me from making stupid mistakes, and force me to wait one minute before submitting after a wrong response.

00:11:38 / 00:38:02

Using zip to read a table of rows into columns is second nature to me. And while the implementation can sometimes be a bit lengthy, I find the result concise, clear, and elegant: zip(*map(str.split, f))

00:44:56 / 01:12:45

It took me over half an hour to understand the part 1! I then fell into the trap of part 2, listing all the paths when all I had to do was count them. Seeing that the result would take too long to arrive, I continued searching for a better solution. Unfortunately, the initial script was already running. Reboot. Also proposing an AWK script (./Laboratories.awk input.txt).

00:34:36 / 00:51:51

I can't explain why it's taking me so long. The first draft is very quick, but there are still a lot of mistakes. The goal of my participation was to improve in this area. I don't see any progress yet :(. But I'm still having a lot of fun :).

00:05:46 / >24h

Glad to have this solution for part 2: The initial region is delimited by a thick border of 1 unit. The border is expanded of 0.5 unit to become infinitely thin. Then the problem is easy to solve.

00:22:37 / >24h

Definitely not an problem that can be solved by a graph traversal. I spent a lot of time optimizing this traversal. Then I pulled a book on linear programming out of my library. I finally decided to use a third-party module.

00:35:40 / 08:09:53

In short: recursion & memoization

00:54:57 / >24h

I think we should take this as a hoax. That's what I thought anyway, and I just counted the number of 3x3 squares that each region can contain.

I had to solve the puzzles on days 9 & 10 before I could unlock the last star. Another great year for the AOC!

About

My solutions for Advent Of Code 25 using Python.

Resources

Stars

Watchers

Forks

Contributors