Daria's Avatar

Daria

@gereleth.bsky.social

Data scientist. I love coding and puzzles. Play my pipes game: https://hexapipes.vercel.app/play

41 Followers  |  44 Following  |  60 Posts  |  Joined: 29.10.2024  |  2.1034

Latest posts by gereleth.bsky.social on Bluesky

Wanted to read it but all I get is a
NGINX 502 Error :/

23.07.2025 15:47 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Post image Post image

My pipes game just got two new grids =)

I like the mix of hexagons, triangles and squares - hexapipes.vercel.app/rhombitrihex...

And the triangular grid is just pure minimalism - three distinct tiles and that's it hexapipes.vercel.app/triangular/5

18.06.2025 14:32 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Post image

Saint Petersburg at night as seen from an airplane window on my recent flight. Spectacular view.

07.01.2025 13:24 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Preview
Advent of Code 2024 Visualisations - YouTube Animations illustrating the solutions to Advent of Code problems of 2024.

A playlist of all the animations I made for #AdventOfCode 2024:
www.youtube.com/playlist?lis...

Managed to do a total of 14 days with #py5. Curiously the number is exactly the same as in '23 when I used #pygame. Each video has a link to the animation source code if you wanna see the messy plumbing)

26.12.2024 21:36 β€” πŸ‘ 10    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Did you have prior experience with C++ before deciding to use it for the Advent? =)

26.12.2024 18:13 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Why are some points going blue? Are those part 2 obstacle locations? The animation makes me think there is some trick to finding them that I'm not aware of)).

26.12.2024 08:45 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

One other thing I tried before was to represent a sequence of changes as a single large number (like 4 digits in base 19 because there are 19 possible changes in -9..9)
Then the 5d array can be a 2d array, where the other dimension is 19**4. But timings were about the same as 5d approach.

25.12.2024 20:15 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I just tried line profiling and indeed the last line with `sequences.clip().sum().max()` takes 50% of total part2 time. I tried putting the buyers dimension last - no change in performance.
It's just a heavy operation however you slice it I think =).

25.12.2024 20:15 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

I was wrong here, numpy is also very good for day20 (Race Condition). If distances from starting point are a 2d numpy array then for every cheating offset you can get the gains for the whole grid at once. My solution time went from 1.7s to 100ms when I switched to this approach.

25.12.2024 18:55 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

I thought light grey was a background color, was pretty puzzled how the dark grey stuff could mean locks πŸ˜…. Almost asked you about that))

25.12.2024 14:59 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Fast solutions aren't general, they use some properties of the input that aren't in the task description. I studied the input program's flow on paper to figure out a shortcut for part 2. A direct "black box" approach does take forever.

25.12.2024 14:46 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I want to debug that circuit with real wires πŸ˜„

25.12.2024 08:57 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Post image

Pretty proud of solution times this year - all days run in just ~2.5s.
Day 20 Race Condition used to take almost 2s before I gave it some numpy love.

#python solutions and animations code here: github.com/gereleth/aoc...

25.12.2024 06:29 β€” πŸ‘ 6    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

All done with #AdventOfCode 2024. Fun ride as always!

Most memorable days for me:
- Day 14 (find the tree)
- Day 21 (robots inception)
- Day 24 (so that's how binary addition works!)

#py5 was very nice for making animations and I learned to use a statemachine to manage vis data

25.12.2024 06:29 β€” πŸ‘ 14    πŸ” 1    πŸ’¬ 1    πŸ“Œ 0

Thanks, #AdventOfCode, now I know how to construct a binary addition apparatus from logic gates 🀯

I submitted a handcrafted part2 answer earlier but I've now written some code that finds the swaps. Who knows if it works on other inputs =)
github.com/gereleth/aoc...

24.12.2024 20:51 β€” πŸ‘ 5    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

They are clumped together rather nicely!

23.12.2024 20:37 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Well to be honest this is the first time I've imported numpy in this year's advent :)

23.12.2024 17:14 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

I made a couple of manual adjustments to avoid white edges intersecting).
And 0.5px stroke weight is great for hiding the outer hairyness.
I couldn't untangle the crowded third layer, some connections through the center are unavoidable.

23.12.2024 15:34 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I was randomly throwing networkx layouts at the problem, and spectral clustering split nodes into sort of growing layers:
..
|\
....
|\\\\
.......
Where the max clique was the tight group on top. So I made these concentric circles going in bfs layers from max clique.

23.12.2024 15:28 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

I had a similar solution at first, only I had a dict with total sequence profits and a separate "seen" set that I reset between buyers. Ran in ~6s.

Then I switched to a 5d numpy array for sequence results and worked on buyers in a vectorized way. Takes ~0.7s now. github.com/gereleth/aoc...

23.12.2024 14:12 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 2    πŸ“Œ 0
Post image

Cutesy structure this graph has. Outer layers are still hairy, I haven't figured them out =).

#AdventOfCode Day 23 LAN Party

23.12.2024 10:48 β€” πŸ‘ 7    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Video thumbnail

#AdventOfCode Day 20 - Race Condition

Showing millions of cheats is tricky so this one turned out a little weird =). In part 2 it repaints the points by their total possible cheat gains. Pretty neat structure shows up.

#py5 animation code: github.com/gereleth/aoc...

22.12.2024 18:35 β€” πŸ‘ 17    πŸ” 2    πŸ’¬ 0    πŸ“Œ 0
Video thumbnail

#AdventOfCode Day 21 - Keypad Conundrum

The robots almost broke my brain this morning, this was super hard for some reason.
But at least the solution works pretty much instantly.

#python solution code: github.com/gereleth/aoc...

#py5 animation code github.com/gereleth/aoc...

21.12.2024 17:48 β€” πŸ‘ 6    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Isn't Manhattan distance just abs(xa-xb) + abs(ya-yb)? Why walk the path at all to find it?
Or maybe your data is stored differently, linked list style...
I have points as tuples (y,x) so Md calculation is just arithmetic and so is the diamond loop.

20.12.2024 21:04 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I'm talking about this difference:

for every node in path after a:
is it close enough?
is the gain good?
=> median ~5000 iterations for various `a`s

vs

for every node within 20 manhattan of a:
is it in the path?
is the gain good?
=> ~400 iterations for every `a`

20.12.2024 20:11 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

This looks like it scans something like
for a in path:
for b in path[from a]:
...
(probably?)
Maybe scanning around `a` in a diamond-pattern would be faster with fewer checks.

But this is my longest running task too so what do I know lol πŸ˜…

20.12.2024 19:48 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

I think this "search for other point in the path" is what takes long.
`const index = pathStrings.indexOf(key)`
It can be just a Map lookup of distance to finish.

20.12.2024 13:25 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Hmm, I didn't realize the path from start to finish covered the whole maze!
I did it this way - get distances start-to-point and point-to-end for every traversable point. Iterate in a diamond around each point and check if dstart[p1]+manhattan(p1,p2)+dfinish(p2) is good enough. Runs in ~2s.

20.12.2024 13:18 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Cool stiched together look! But I struggle to understand what color means here.

What's your approach to part 2?

20.12.2024 13:10 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Video thumbnail

#AdventOfCode Day 19 - Linen Layout

Some dynamic programming if not dynamic visuals.
No idea how to show full input, there's 400 sequences there =).

19.12.2024 18:18 β€” πŸ‘ 7    πŸ” 1    πŸ’¬ 1    πŸ“Œ 0

@gereleth is following 19 prominent accounts