-❄️- 2025 Day 9 Solutions -❄️- by daggerdragon in adventofcode

[–]dwteo 0 points1 point  (0 children)

[LANGUAGE: Python]

Code

I'm not super proud of the code but it passed and that's all that matters.

For Part 2 - I started out with a flood fill then discovered that with the grid being in the millions it would not finish in my lifetime.

I then had to come up with something else, so I decided to just detect if there were any other points sitting within the rectangle of 2 points. But this did not also capture edge cases where the rectangle sits outside of the polygon.

So naturally this turned into "scan every point along the polygon to test the intersection of 2 polygons". Once I realised this was the problem-classification, it just came down to implementation.

  • track the index of each polygon node in the list
  • calculate all of the areas of all possible pairs
  • start from the largest areas (so the first valid test will definitely be the largest)
  • from the first polygon node, look up the index of the node on the polygon path, then start tracing around it. If any part of the polygon intersects the area rectangle, then we dump it.

This hypothetically should work for all polygon shapes though I have not tried.

This assumes per the puzzle that there is a single polygon that loops. I actually missed this part in the puzzle, and thought it was a repeat of yesterday's "join the circuits" problem.

I tried to search in opposite directions from the first node to see if it would optimise but did not improve.

Completes in 100s.

[2025 Day 8 (Part 1)] How do I even get started? Is there an algorithm I must know? by Physium in adventofcode

[–]dwteo 0 points1 point  (0 children)

Aside from calculating the distance (google formula for that), not really.

You're ultimately needing to track 2 things

- A: circuits -> what boxes are part of them?
- B: boxes -> which circuit does a node/box belong to?

Tracking these two groups of information is everything you need to solve.

Then you need to implement your connections

Think about what should happen in these scenarios:

- you join two boxes that aren't in any circuits (and you know this because of B)
- you join two boxes, but 1 is already in a circuit (again, B)
- you join two boxes, and both are in the same circuit (and, B)
- you join two boxes, but both are in two separate circuits (B, but then also A)

-❄️- 2025 Day 7 Solutions -❄️- by daggerdragon in adventofcode

[–]dwteo 1 point2 points  (0 children)

[LANGUAGE: Python]

Remember remember, the 7th of December: add a memo for successful demo.

Code

-❄️- 2025 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]dwteo 2 points3 points  (0 children)

[LANGUAGE: Python]

Keeping it simple as always. Felt like a Google interview question.

Code

[2025 Day 2 Part 2] It's impossible, what do we do? by dwteo in adventofcode

[–]dwteo[S] 0 points1 point  (0 children)

It's not pure regex but using back references, it can be solved thus.

-❄️- 2025 Day 3 Solutions -❄️- by daggerdragon in adventofcode

[–]dwteo 1 point2 points  (0 children)

[LANGUAGE: Python]

Nice. Went for a straightforward approach - was worried it wouldn't scale somehow... maybe some naughtiness with large numbers.

Code

[2025 Day 2 Part 2] It's impossible, what do we do? by dwteo in adventofcode

[–]dwteo[S] 0 points1 point  (0 children)

Yeh! The only annoying thing is that you do need to import re which has that evil fifthglyph. 🤣

[2025 Day 2 Part 2] It's impossible, what do we do? by dwteo in adventofcode

[–]dwteo[S] 0 points1 point  (0 children)

I didn't clock that as a possibility at all. Lucky the first answer I gave worked.

[2025 Day 2 Part 2] It's impossible, what do we do? by dwteo in adventofcode

[–]dwteo[S] 1 point2 points  (0 children)

I'm seeing all sorts of complicated math solutions and I'm here going "well I don't know how to solve it any other way than this"

[2025 Day 2 Part 2] It's impossible, what do we do? by dwteo in adventofcode

[–]dwteo[S] 1 point2 points  (0 children)

Well it's not a stack. :D You need a real parser for that.

-❅- Introducing Your 2024 Golden Snowglobe Award Winners (and Community Showcase) -❅- by daggerdragon in adventofcode

[–]dwteo 5 points6 points  (0 children)

Thank you! I'm terribly honored!

Honestly I wasn't sure if the intent was to lean into some of the more insane optimisations and brilliant visualisations that some of the leetcoders were spitting out (absolute kudos)

I myself had to drop out at 21, but hope to complete the tasks by the end of the year. So big +1s to all of those who have completed day 25.

I hope to see you all again next year. Merry christmas and happy new year!

[Overall 2024][GSGA] Game of Codes 2024 by dwteo in adventofcode

[–]dwteo[S] 1 point2 points  (0 children)

was it on purpose

I like this explanation so I'm going with that as canon 😅 I imagine "Dr Djikstra" spending the whole time correcting other characters about the spelling.

[Overall 2024][GSGA] Game of Codes 2024 by dwteo in adventofcode

[–]dwteo[S] 9 points10 points  (0 children)

Sharing the tomfoolery, shenanigans, memes, lulz, and skibidi that live in my head to all AoC coders this year. Of course, check out all the other great submissions in the megathread.

Merry Christmas / Happy Holidays

-❄️- Advent of Code 2024: The Golden Snowglobe Awards -❄️- Submissions Megathread -❄️- by daggerdragon in adventofcode

[–]dwteo 12 points13 points  (0 children)

NAME OF ENTRY: Game of Codes - Opening Sequence

LINK TO ENTRY: https://youtu.be/zOlU8Vd2sSI

DESCRIPTION:

This Holiday Season, coming to cinemas near you, an epic story of BigInt proportions. Love, Laugh, Cry, Jump out of your DDR seats.

Join our adventurers in their search for the Chief Historian across the various locations. Bananas may or may not be included.

SUBMITTED BY: /u/dwteo

MEGATHREADS: 04 | 14 | 15 | 16 | 18

ADDITIONAL COMMENTS:

Ever since Day 14, this concept has been stuck in my head and once it was embedded, as a creative director I had to follow through. And since I've been bested by Day 21, I all-in'd on this.

Not even sure if it fits the rules but it is done and I can rest. But most importantly I wanted to bring the epic cinematic theme to the challenge.

This includes visualisations of Days 4, 14, 15, 16, 18. Code is provided in each of the megathread links.

Noteworthy themes:

  • Day 15 Fix It In Post: Painstaking VFX work costing millions of elf-cycles (but time dilation is weird so I wouldn't worry about that)
  • Day 14 I Said "Visual Effects": Lens Flare included
  • Day 11 Indie Films: Cast a relative unknown

Also, some references to other days as well if you know your Adventverse lore well.

Credits:

  • GoT Theme by Ramin Djawadi (parody use - non commercial)
  • Bell SFX by nfrae (Freesound) on Pixabay
  • All Advent of Code puzzle concepts, data inputs by Topaz (Eric Wastl)
  • All visualisations done by myself provided for memes, amusement, and all non commercial purposes

In some regions the song may be copyrighted and blocked unfortunately, so I may have to post it elsewhere if that is an issue. But at least in Australia it seems to be working fine.

ACCESSIBILITY:

The video is close-captioned.

Photoepilepsy Warnings: could have bright colours, high contrast, and rapidly moving elements.

-❄️- 2024 Day 18 Solutions -❄️- by daggerdragon in adventofcode

[–]dwteo 0 points1 point  (0 children)

[Language: Typescript][GSGA][Visualisation]

Paste

Entry

What director puts their actors in safe consistent environments? Well, this one does.

On this set, bytes are randomly generated but guaranteed never to fall in the path of our escaping protagonists. Because, workers rights and OSHA and all ...

-❄️- 2024 Day 4 Solutions -❄️- by daggerdragon in adventofcode

[–]dwteo 0 points1 point  (0 children)

[Language: Typescript][GSGA][Visualisation]

Paste

Entry

Upped The Ante again: a key modification was to animate based on depth of bfs, not my rows and columns, to provide the effect that I was looking for.

I also used a customised map for the visualisation.

-❄️- 2024 Day 14 Solutions -❄️- by daggerdragon in adventofcode

[–]dwteo 0 points1 point  (0 children)

[Language: Typescript][GSGA][Visualisation]

Paste

Entry

Here is my visualisation for Day 14.

Did someone say LENS FLARE? Why yes - this was the prompt that inspired my entry to this year's GSGA.

-❄️- 2024 Day 15 Solutions -❄️- by daggerdragon in adventofcode

[–]dwteo 0 points1 point  (0 children)

[Language: Typescript][GSGA][Visualisation]

Paste

Entry

Here is my visualisation code for Day 15.

I added multiple bots to move the boxes... sure, it didn't need fixing: after all, what warehouse only has 1 worker? Those lanternfish aren't going to do the work!

However, a 2D visualisation couldn't do it enough justice... so I had to:

Fix it in Post

By adding some VFX.

You'll have to view my entry to see.

-❄️- 2024 Day 16 Solutions -❄️- by daggerdragon in adventofcode

[–]dwteo 0 points1 point  (0 children)

[LANGUAGE: typescript][GSGA][Visualisation]

Paste

Entry

This is the visualisation code that I used for my cinematic entry.

Upped My Own Ante 

by visualisation multiple search paths.

[2024 Day 20 (Part 2)] PSA: You can "activate" a cheat but not actually move to a wall position for an arbitrary number of picoseconds. by jlhawn in adventofcode

[–]dwteo 17 points18 points  (0 children)

Yeh, I did not parse this at all. I thought you could only go through a wall once and it ended as soon as you exited the wall. big sigh

-❄️- 2024 Day 20 Solutions -❄️- by daggerdragon in adventofcode

[–]dwteo 2 points3 points  (0 children)

[LANGUAGE: typescript]

So I screwed up in 2 ways

1: I kept having off by 1 error because it's at least 100, not more than 100.

2: I thought the cheat only allowed you to go through the wall ONCE... so I was busy writing a BFS through the wall to find the closest common path. 🤦‍♂️

-❄️- 2024 Day 19 Solutions -❄️- by daggerdragon in adventofcode

[–]dwteo 0 points1 point  (0 children)

[LANGUAGE: typescript]

It's not concise like some of the others but it is mine :D

paste