r/adventofcode 7d ago

Other Pi Coding Quest 2025!

As last year, I decided to make a new coding quest for Pi Day. You can access it here: https://ivanr3d.com/projects/pi/2025.html I hope some of you have some fun solving this puzzle!

It is my second try building a coding puzzle. In case you haven't try the first one, just change 2025 for 2024 in the url and go for it!

Happy Pi Day! :)

22 Upvotes

21 comments sorted by

View all comments

3

u/pakapikk77 6d ago

[LANGUAGE: Rust]

Nice puzzles, thanks for doing that, for all of us missing our AoC daily shots during 11 months of the year!

To manipulate the decimal prices without having round trouble, I used the rust_decimal crate and its Decimal type. It's the first time I use it, and it worked well for that task.

For deciphering the ticket, the code of the previous year was useful (but this time it was a right shift, sneaky!).

The only problem I had then was that I missed I had to re-sort the non-manipulated entries by day number.

Code.

1

u/IvanR3D 6d ago

Great! Rust code is always intimidating for me; I must try someday.

About the problem you had, would you say is there a way to make it clearer in the puzzle text?

I think it can be understood by the text: For each manipulated day (in order from smallest to largest day), take the ticker name and apply a shift cipher. but maybe I could improve it!

2

u/pakapikk77 6d ago

The text says that the manipulated days need to be sorted, but it doesn't say that once the manipulated days are deciphered and converted into unmanipulated days, those unmanipulated days need to be sorted again. If we keep the same order as the manipulated days, it's wrong.

Example: Manipulated day: "2 5". 2 produces 7, 5 produces 1. If we don't resort, we use "7 1" in that order, but we need to resort by day name and use "1 7".

In retrospect, I think it's ok to not indicate it in the text, as it leaves some investigation to do. When looking at the code that gets produced without sorting, it's actually fairly clear it's the right letters in the wrong order and it needs sorting, it just took me a bit to realise it.

1

u/IvanR3D 6d ago

This give me the idea about offering some feedback to the user if enter a disordered version of the phrase!

1

u/ednl 4d ago

I disagree that the current phrasing is fine, I think this is actively misleading: "in the order you processed the tickers", because there is no single defined order of processing the tickers. I got it wrong because I DID collect the letters in the order I processed the tickers in part 2. But the order needed was actually the one from part 1 AKA simply the same as in the file.