#advent-of-code
1 messages · Page 29 of 1
beacon scanners gives me nightmares…….
do you consider "complete" as in finish it on the day? <24 hr
I'm planning to try out previous years after day 25
or does advent end on 24
i’ve been lucky enough to finish the days at that pace but that’s definitely not what id consider “complete”
just as long as you do all the challenges for each day
yeah i think that's good enough for me too 😄
somewhat?
if it’s anything like previous years, ||the part 1 for day 25 is super easy, and the part 2 is “did you complete the rest of the calendar”||
hahaha
traditionally the last few days are easier than the middle days so that people can spend time with their families
and the calendar looks a bit special when you get all 50 stars too
I've finally finished day 20 😅
🎉
be me
stuck on day 20 for a couple days
finally get part 1, but it takes ~15s to run
whatever, part 2's the real challenge and ill need to refactor anyways
read part 2
ohgodpleaseno.png
im gonna need a better algorithm
wait hold up do i tho?
parametrize one hard-coded number and slightly refactor some of the code
f*kin works first try
d20p1: 2 days. d20p2: 5 minutes
am i... could i maybe be... sm-smart?!?!
combine with https://adventofcode.com/2022/day/21 for more monkey business
<@&518565788744024082> Good morning! Day 23 is ready to be attempted. View it online now at https://adventofcode.com/2024/day/23. Good luck!
21 seconds 😂
28/60 😌
I just want to be top #50 global this time and I'm still in it. 🥹
also, i just broke 1000 points! 🥳
you sure will! All the best to you! You shouldn't have taken a break though. You'd easily have been top 5 😅
ohh, sorry about that! :/
your "slow" is still top 100 both parts 💀
god i love solving np complete problems
just use ||nx||
Yeah I figured people who know how to use that would do well
my p2 runs in 35s for today 💀
😭
I'm not one of them so I got 342/235 lol
disgusting
Mine runs in 4s but I'm not convinced it's sound
gnns have made me way too familiar with it
i forgot does star 2 of day 25 require that i have all other stars done
Lmao
Yeah.
i completely forgot lmao
Mine runs in 0.5s
I got sub-1000 ranks 5 times this year, so I'm super happy with that. Especially with a bunch of the sub-1000s this year being taken up by... not people.
🦀
Hello every one I just started data science with python I’m super excited to be here anyone wanna put me through because I’m having thought time about the course
doing the last couple days on a phone and im so happy i made my helper script download the input
last year i was running stuff through a discord bot and giving it the input was a mess
i completely butchered my day 23 😂
- and have a top 10 rank in pydis
ah i meant today and 24 and 25
i'll probably slip down the leaderboard a bit
i have a helper script that can download the input and the template that im using reads a file relative to its own path so all i need to do to run my code is :! python3 % :D
too strong
oop just realizing the comment about arithmetic expansion is no longer valid
the script broke on day 8 because octal so i switched to bc lmao
You need to add a custom user agent for automatic request including the contact details (e.g. email/GitHub) of the creator of the helper script so Eric can contact you
oh true forgot about that
had it in the last script
done
is it called cheating if i used ||networkx|| for part 2 of todays problem?!
I mean it's whatever
i clicked open workspace in vs code vs code told me the workspace is already open
your choice, I expect loads of people to use it for a lot of these problems
I don't, but that's more because I'm a masochist and don't want basically any library code during aoc
I mean you are also in rust
compiled in rustc, without any additional crates 🙃
but yeah sure
especially for graph stuff I've always done my own thing regardless though
I'm trying to stay away from it as well
at least for today
since it's just ||like 2 lines of code||
it's not much needed to have a good enough solution yeah
same
i need to learn networkx in general
||networkx|| ftw woo 🙌
ok i don't understand rust, and it does not help that rust-analyzer isn't working in neovim
😔
(also, works on my machine)
i need a good read for ||bron kerbosch algorithm cause i can't find it on cp algorithms usaco nowhere smh||
you can just improvise a good enough algorithm
Does ||generating all subgraphs count as good ||
tl;dr it's a non-mutable reference
but it keeps track of things at compile time so you don't do anything bad
e.g. you can have multiple borrows at the same time, but mutable borrows are more restricted
that's a bit too bad
I went about it like ||"assume node v is part of the clique and that it's the smallest label in the node, grow the clique in all possible ways"||
and ||do that for all v||
I succeeded with something much dumber than that
i succeeded with something that in hindsight should not have worked
Hello people, someone here is good dealing with Pydantic?
I have been dealing with an issue for a week. I have searched online and even tried using ChatGPT, but I haven’t found any answers.
for advent of code? maybe not the correct channel.
There is #1035199133436354600 though
I did my question but they did just close it after some time and I don't even know why 😿
https://discord.com/channels/267624335836053506/1320798794110992405
@strange zinc
you can repost it
i completed day 23 with a pencil and a piece of paper
oh boy. nice work
threads close automatically after an hour of inactivity. you can create them again.
Good luck everyone
<@&518565788744024082> Good morning! Day 24 is ready to be attempted. View it online now at https://adventofcode.com/2024/day/24. Good luck!
Are they hacking?
what
Well today marks my first 'solution so bad I crash my entire laptop'
chat am i spending my whole day on this
||so bruteforce selecting NC4 is not working i suppose||
which is very obvious
||more like NC8||\
is that possible?
nvm its not
for our given tc its not
so another advent of ||reverse engineering perhaps||
thats the route id go for ngl
right now my x + y and z are very close already
when i saw very close i mean ||1e13||
that's what I'm trying ||and it looks promising||
nice
I tried ||just shoving it into z3|| but that doesn't seem to have worked
Well I guess I'll see if this does anything but I'm really not seeing the proper way to do this
this is ||model based diagnosis|| but ughh
I think my current solution is technically O(n!^7) lmao
is there a tool for this
but how do you tell ||z3|| about the || 4 pairs being faulty thing||
does it support that
||health indicators lol||
didn't help :/
oh if only i could use this
🥲
nope, instead we have ||manually picking apart the calculations for each digit||!
dead
Might be time for me to go and have breakfast lol
Haven't made much progress on this
so close yet so far...
dont tell me this is an ||easter egg||
holy shit
just so im not going insane, is it easier to ||find pairs of swapped outputs, or find all faulty outputs overall?||
||my input had no swapped outputs at all||
i am getting output and numbers! ||31688159490575|| lol is that close
i think !
hint: ||sort each wire by its depth (how much recursion you need to find the output)||
hint 2: ||simplify xN AND yN and xN XOR yN||
hint 3: ||full adders...||
do you guys think it’s possible to use cuda to brute force day 17 part 2 ||the programming language problem||
🎉
for p1 i was ||running a while True loop until the set of instructions empties itself lmao was recursion possible||
okay oh you made a ||tree or soemthing||
Then ||the depth would be the number of iterations you need to find the output||
||do we need a tree for every z wire?||
Not really
i see
disgusting
this is…python.
with a supercomputer yea
what is meant by ||simplify AND XOR? is it like changing them to xN XOR yN = (xN + yN) % 2, xN AND yN = xN + yN == 2?||
||simplify their names, e.g. if I had x12 AND y12 -> abc I would rename abc to A12 for clarity||
This helps because ||the pattern becomes much clearer like this||
yeppers
btw ||sympy helps a ton||
esp because for me
||the bad wires were immediately obvious||
||simpy?||
they have ||bitwise operators ?||
i didnt know that
i suppose they do
😦
umm am I ||just not doing any actual search here and just look at where the wire pattern breaks....||
that would be kinda underwhelming
what’s funny is i have access to one
my university’s high performance computer to be exact
Yup, that was a segfault in Z3 lmao
Hopefully tomorrow's will be much easier
Kinda tempted to have you try to run my Z3 solution on it to see if it still segfaults lmao
My usage didn't really have any crazy spikes though so I think it's just 'Z3 did something strange and crashed'
i’m sorry but i can’t do that for you
unless your computer uses a ton of gpu or a ton of threads there’s basically nothing that’s gonna change anyway
A) that's fine
B) I'm like 90% sure Z3 would still crash anyway
what is ‘Z3?
Z3 is a theorem solver
Yeah the solution that segfaulted was an attempt at d24
Technically if it didn't segfault it should give the right answer
isn’t segfault usually indicative of a software bug
that’s going to happen no matter what computer you run it on, right?
The segfault in this case was probably Z3 failing to allocate
oh, so you need a lot of ram then
(I'm not sure why z3 needed to allocate, but I don't know the internals of z3)
if you really wanted to try this you could probably make some amazon ec2 instance with a ton of ram
but remember to shut it down when you’re done so you don’t use a ton of money
It should only be about 98k variables, I'm not sure why it would be running out of memory
i don’t know then
¯_(ツ)_/¯
does task manager show any resources maxing out
I have graphs in my bar but they didn't seem to go much higher than normal
¯_(ツ)_/¯
💀
Literally solved today's pt2 by hand in Notepad by ||recreating each full adder individually and seeing where the mismatches were|| 💀
lol... 3+ hours and still not even 1800 pt2 solves
Day 25, pt1: Help! The elves have detected a single broken NAND gate in this 16-bit CPU. Can you find it for us?
nah it would probably be some cosmic rays flipped some unknown number of bits in my cpu register, please find when it happened and how many bits are flipped
We know when it happened... while Santa was doing a Mario 64 speed run and clipped through the ceiling
i think a lot of people might be busy for today with it being christmas eve and all
tho tbf p2 is decently hard
> weekend puzzle is easy
> monday night puzzle is balls hard
what did eric mean by this
trying to use ||graphviz|| on this problem was a mistake
Some cultures/countries celebrate more during the Christmas Eve! Usually in the evening, of course, but the preparations can take time.
(Me who dropped AoC early this year but still browse this channel and all of pydis between preparations)
okay, thanks you 
someone did help me yesterday
surely it can't be that bad? 🥴
10,162x16,763 pixels
okay sadly || i drew the entire full adder assuming the non xyz wires will be constantly used throughout all the bits wrote a script to store them all, later found out the equations are not the same ||
kms
someplace they are doing ||x08 AND y08 and directly storing it into z08|| which does not make sense at all
wtf
guess what, ||that's one of the swapped wires!||
tbh I want to skip today's part 2
But idk if there's any better method without manually drawing the circuit map
Heres what I have got from the adder:
||```py
rules
x_n XOR y_n -> X_n
x_n AND y_n -> A_n
c_n XOR X_n -> z_n (sum)
c_n AND X_n -> t_n
t_n OR A_n -> c_n+1 (carry)
i might solve this one manually before trying for a generalized sol
what i've done so far lends really nicely to doing it manually
i'll do this next yr ig
was busy with ncc
Maybe Eric will be generous and tomorrow will be like, "Oh no, an elf fell asleep on the keyboard while typing his password and typed a bunch of extra B's. Remove the B's and figure out what he was typing."
the 25th problem is always easy from what I've heard
It depends, day 25 part 2 is the least finished puzzle each year. 🙂
dunno, every single day 25 part 2 has been finished
By you or in general? Because yes I would assume that a puzzle gets solved at least by some
:white_check_mark: Your 3.12 eval job has completed with return code 0.
True
just a statement about members of the empty set
@past jay this isn't the right place to run code
mmk
You want #bot-commands
ty
im so lost on this
i know what i’m supposed to be checking for but im not sure how to check it
i really hope tomorrow doesn't require all 499*'s celebrating 10 years 💀
💀
Part 2?
yes
Dm ok? I have a graphic that might help
||start from the first digit and stop when you find the first difference? Add the binary numbers together yourself and compare||
did that too
above is expected, below is actual
i looked at ||the operation for the 9th digit from the right on a graph||
OH
WAIT
||each output (zXX) should be the result of some xor gate||
and ive already been checking ||which outputs are not the result of xor gates||
there's exactly ||4 of those||
Then I guess ||you're halfway to finding all 8 mismatched output wires||
Day 25! Sheesh we made it to the last day chat
For what it's worth ||only 3 of those 4 are wrong|| - I wasted a lot of time on that...
yep, managed to get it eventually
🫠
i swear, if eric pulls something on us for tomorrow cuz its the 10th anniversary
i'm really struggling with this one. I get that ||i need to look at the entire chain of full adders and find which ones are wrong, but once one thing is wrong, everything starts to look wrong, and it's difficult to understand where the wrongness ends...||
like i see for example that one of my ||output digits which should be sum_out XOR carry_out is something else, so that obvoiusly means that that output digit is one of the wrong ones. but now if i dive deeper into the 2 inputs that were unexpected, i have no idea what i'm supposed to expect from them||
i had a similar problem then i renamed the equations
||xN XOR/AND yN -> <non-xyz-wire> to xN XOR/AND yN -> A/B followed by N, specifically AN for xor and BN for AND , then printed chronologically, this helped me a bunch, because then you can map things to the structure of a binary full adder and spot the flaws ||
jesus, reading this broke my brain lol. I'm not sure i fully understand what you mean
||Look at the basic full adder. Pattern should stay the same. I just started drawing the pattern out on paper||
basically improve the readability
but how do i know when the wrongness ends? as soon as something is wrong, i lose my ||place in the schematic and no longer know what to expect. so if two wrong things are chained together, how do i know?||
||find all the wrong things, there are not many if you filter enough||
||that's what i was trying to do, until i realized that as soon as one thing is wrong, everything after it will also look wrong||
i assume ||you are not dealing with actual values they have||
its just ||4 pairs of wires , rest all should follow the correct binary adder logic||
||isn't that a bad assumption though? theoretically 2 or more mistakes could be chained together right? which would look like a huge mess||
||like i guess as soon as i see any issue, i just skip to the next z digit, i was sort of considering that but was afraid of there being 2 or more issues in the same adder||
i dont think we can ||pin point the exact wires by working with bits||
it will indeed create a huge mess
this is essentially what i'm doing: https://paste.pythondiscord.com/4SPQ. nothing clever about it. but it of course doesn't work
basically, ||looking through my adjacency list and whenever i see something i don't expect, i assume the output needs to be swapped||
more intuitively, ||i'm going through the full adder backwards, and keeping track of outputs when any of the inputs or gate is not what it should be. but as soon as that happens, anything below it will also not be what it should be, and so i'll incorrectly think that output needs to be swapped as well||
yeah exactly , it would ||flip so many things||
if we think about this ||in terms of wires, its like this figure, A and B being xN and yN, S "should" be zN, ||
right
and by manually checking i found out there are || no discrepancies in xN xor/and yN||
so we can ||label the thing they produce prolly||
hmm, am I shooting myself in the foot ||by trying to look through the schematic backwards? should i start from each xN and yN to check if their output is what i expect?||
yes more like ||are their operands consistently being used||
for example ||AN BN being always produced , AN should always be one of the operand in the final XOR, BN should be one of the operand in OR (Carry out)||
||and they MUST produce zN||
the part that confuses me the most is the ||XOR input to the sum out, and likewise the AND input to the A input of the carry out||
like without context, it's impossible to know if those are right because they're just 3 random letters
exactly
||well you are adding 3 inputs together and outputting it as s and cout||
that was the reason for this
oh, ||you renamed them?||
yes
interesting
||>> XOR input to the sum out||
|| what XOR is connected to is something you could check ||
well it's either connected to ||a zN wire, or it's connected to a random 3 letters right? if it's connected to anything else then it's wrong, but it could be connected to a random 3 letters but not the right one, in which case it's more difficult to identify that unless i rename those i guess?||
i guess it could also be ||connected to the wrong zN, which would also be confusing||
|| you could check operands of a XOR for being x,y or result for being z ||
||the operands could be a pair of 3 random letters though. I wouldn't know if they were the right ones||
oh that's why you said ||the result being a z||
i see...
||if none of the checks work, then something is off with that XOR ||
right right, ||because the inputs of a gate never need to be swapped, those are all correct. it's only some gate outputs that are wrong. so I can either confirm it's right by the gate inputs being what i expect, or the gate output being what i expect...||
|| like the XOR could be connected to a wrong z and you wouldn't know, but if it isn't connected to z at all and the inputs are random -- you know this gate is off ||
||the only gate i'm confused how i'd verify now using that method is the AND connected to the A input of the carry out||
||it's not too hard to look 1 level deep, to find what the AND is connected to||
i guess so
if i solve this soon, i hope you guys will still be around to help me with day 21 part 2 lol. bane of my existence
I don't plan on spontaneously disappearing
careful not to get locked in a room on a reindeer-class starship either
hah, i thought it only reacted to tree
i'm realizing now that this is actually wrong. ||the inputs of a gate can be wrong because the inputs of a gate are the output of another one. ugh||
intuitively i can understand which output is wrong in this section:
||```py
graph["z19"]
('ndj', 'XOR', 'fvw')
graph["ndj"]
('y19', 'XOR', 'x19')
graph["fvw"]
('ffh', 'XOR', 'gdw')
graph["ffh"]
('vvt', 'OR', 'bct')
graph["gdw"]
('x18', 'XOR', 'y18')
||this zN looks right initially, its `ndj` input is right, but its `fvw` is obviously wrong. but that doesn't mean the zN is the wrong output, the `fvw` is the wrong one. I know that because i can see that based on its inputs, the output should actually be `z18`. I don't know how to verify this programmatically...||
||yeah, you can add fvw to the solution because ffh XOR gdw -> fvw has no x/y operands and no z output||
right, but ||i'm still confused how I should treat z19. like should I just assume it's correct because it's an XOR? that can't be right||
don't assume anything about it, just find more incorrect gates
it's still an assumption, i have to determine whether it's correct or not
intutively i can tell it's correct, but programmatically i'm failing to think of a way
i just have a short list of checks to see if a gate is wrong -- if it's not obviously wrong, continue on
hmm
at the very worst, you get some list of wrong gates, which could make the problem brute-forceable if you are still stuck
i suppose. I have already manually confirmed 5 wrong outputs lol
what were the others and how did you know they were wrong?
well i'm a little suspcious, ||the rest of the ones i found are all z wires, they weren't connected to an XOR gate, which to me is obviously wrong||
yeah, that's another check ||if the gate isn't a xor and it outputs to a z (except z45) it's wrong||
oh right, ||last bit has to be the carry out of the previous, so it should be OR?||
the other checks i did involved looking at whether the result was an operand of a certain type of gate, so going one-level deeper
last bit is an AND i think? i don't remember -- i think you AND with the result and the carry bit
||i think it should be OR, otherwise my z45 would be wrong||
i am sorry that is transparent lmao
either way, i'll be less strict and see how that does
that last gate is a OR gate isn't it
yea it is
i guess it is an or
oh, you do AND with the result and the carry bit, but you have to OR that with whether the result has a carry
electronic engineers should get a new programming language
for instance, if a ||XOR gate output was the input to a OR gate|| i marked it wrong
you mark the ||output of the XOR gate as wrong presumably, right?||
yeah
i feel like the fact that i made a directed graph is making this more difficult
probably, i just have a [(a, op, b, result), ...] list
oooooookaaaaay, that was tough. Anyone around to help with day 21 part 2? lol
i tried ||caching my dfs that simulates the paths, but that just isn't good enough for 25 robots. I'm thinking i need to just calculate the cost of getting from one button to another from the perspective of the robot one level up, so i'm just adding numbers. but i don't really know how to acheive this assuming that is the right approach||
@lime fulcrum you seemed keen on helping, you still around or did you disappear afterall? 
I've got pretty much the same thing as you from what you've described, runs fine in something like 9ms. How are you ||breaking down the transitions for your DFS?||
what do you mean exactly? ||basically my dfs finds every path, and eventually returns the best one based on a few things, length of the path, how many direction changes there are, and how close it is to the A button from the perspective of the robot one level up||
i'm wondering ||if i can just use my dfs to find the length of the path between every pair of buttons?||
Ah right, for me ||I break down the problem at each level into chunks that start and end at the A key||, and that saves a lot of hassle. There should only really be ||at most 2 possible/sensible paths for a given transition btw||
i think you have to consider robots at least two levels up
really?
yeah
Yeah, there are some cases where it matters
I thought I had a bullet-proof thing to avoid ||branching||, but ||there are cases where the option that looks worse at the current level ends up winning||
oh god that's horrifying
tbf, i just do "all possible paths" but thats really only two paths at most
Idk if there are effects beyond 3, I haven't seen them when I was checking why my heuristic didn't always work
But then again why bother pre-calculating when the runtime cost is reasonably low anyway
i don't think so, i skimmed over a description for a non-recursive solution and it seemed like you could directly compute the path by considering 2-levels up
I might go back to finding the right heuristic later if I really need it to get my total AOC runtime down but that's not the top of my list
i'm not gonna pretend to know the iterative solution
I have a ||cached function that takes in the string to work on, starting and ending at A, and a level. It goes through char by char looking at the transitions, and for each transition it finds what possible paths take you between those chars, and recurses to find the cost of the (max 2) paths available||
this is fast enough for ||25 robots deep??||
The ||possible path|| computation is also cached, not that it's massively important
Plenty fast
but wouldn't the paths be getting absurdly long?
cache really reduces the problem, i had around only 300ish entries in my cache afterwards
No, because any path is either: ||the path we were given to solve, or a path to get from one char to another for the robot above||
So the paths are all tiny
i'm not following, ||is the path a string of characters? or a number representing the length of the best path?||
String of chars
That's the key part: ||you can split every path into a bunch of char->char transitions and compute the paths one level down for a single transition at a time. They can be cut up like this because they all start and end at A so the end of one is always the start of the next||
oh
wanna see day 21 visual, it's kinda spoiler free
i'll look at a visual, sure
super clean as always salt, well done
So ||1234A -> cost(A to 1) + cost(1 to 2) + ...|| and ||cost(A to 1) -> ^<<A -> cost(A to ^) + ...||
I always love seeing what you come up with
i was working on one for today, but i've been really tired the last few days
suffering from burn out faster than usual
Well no pressure at all, I'll be happy to see em when they arrive
so basically ||you're iterating through the code pairwise, finding the path between those buttons, and returning the length of the path? But that can't be right, because you need to know what the path is so you can do the same thing for the next level up...||
That's where ||branching|| comes in
You may have ||at most 2 sensible paths: say >>>^^^ and ^^^>>>||
Anything else is trivially a waste of instructions for the next level along to run
By asking for ||all reasonable options in the layer below||, you ensure that regardless of the higher level effects you'll always offer the best solution ||among others||
||by "layer below", you mean the next robot in the chain in the direction away from the numerical keyboard right?||
Yes
i need to be hit over the head more lol. ||So for 1234A, the first thing you do is find the best path between A and 1. So are you passing A and 1 to a cost function, which in turn calls some other function to find the best path? and then the cost function returns the length of the path only? and cost is cached?||
that can't be right lol
I wrote ||separate functions just for clarity, in actuality I have def cost(code: str, level: int) -> int: and a def paths(a: str, b: str) -> list[str]: where a,b are single chars||
Both are cached although ||the latter doesn't absolutely need to be since it's not recursive||
what does ||level represent? level in the robot chain? if so how does that effect things? I'm still struggling to connect how you get away with not having to generate tons of paths||
You do in theory, the branching factor is a bit under 2
But the paths are all ||very short so there's only so many unique ones you'll get||
||level is the level in the chain, matters because when it hits 0 then I just return len(code) since that's all the last bot needs to do, also matters for caching because the same path at different levels entails vastly different costs||
To do ||cost(1234A, n) I find paths(A1) then run cost(path, n-1) for each option and take the min. Then rinse and repeat for each subsequent char||
At this stage it's basically my actual code so I can send that too lol
lol i'm so tempted to look at this point, but if i can solve it on my own i'd like to
i am still so confused though lol
Tbh I've basically been saying everything this message contains just spread out a little bit more
I'm trying to leave some dots left to connect
yea i appreciate that
what you guys said about ||the needing to look 2 levels deep to verify a path is best is scaring me still, i'm not sure how to even do that||
This is the essence of the whole thing, except I arbitrarily picked a path
The trick is that you don't actually have to
If you just ||test each option||
it's not something that recursive solutions even really care about -- it's just you can't make certain assumptions about shortest paths is all
You could ||figure out which would be best but that's more pain than just branching||
Well put
like my assumption ||that ending closer to the A button is always right?||
Yup
There is one very important assumption that does survive tho
That being ||the best path is always an L, don't bother with zigzags||
And there's only ever ||2 possible L shapes hence the bound mentioned earlier||
wait do you guys ||recurse through all 25 robots between each 2 buttons of the original numerical code? like A to 1 is either "<^<" or "^<<", and then immediately you recurse doing < to ^ and ^ to <? and so on?||
yeah, except that <^< isn't a possible path
from A to 1? sure it is
ok, not a shortest path
do you prune that branch immediately ||because of the unnecessary direction change?||
yep
i see
i think i can wrap my head around this approach
time to put pen to paper i guess
from A to 1 is either "^<<" or "<<^" but one of these isn't legal because of the missing key
i don't even include that empty space in my graph, it's not possible to find that path
i figurd that was an ok way to avoid it
Yeah this ends up nice and easy
but they are simple
can you elaborate? like are you just checking manhattan distance and then checking if it brings you across the gap?
Yup
my check actually checks start/end coordinates directly against hole coordinates
but it doesn't matter how you do it
||c = "<>"[nx > x]*dx + "0v"[ny > y]*dy|| then ||if y != ... and ...: <path works>||
Plenty of ways to go about it, it's not the expensive bit anyway
right
the "0" pretending to be a "^"
So you could even DFS if you really wanted to 🤷♂️
Yeah I stole that shamelessly
lol
Was so elegant
I didn't send a message about it but that made my code so much neater
it's nice having only one keypad
Although tbh I could have split the recursive function into 2 and then done an array DP
Maybe faster by avoiding the dicts but can I be bothered? Unlikely
remember that problem earlier that was calculate cost of path on graph but turns are real expensive
the reindeer race or w/e?
The cauldron thing
Oh wait not that
Well turns were restricted on that one but not directly costly
Oh wait this year lmao
yeah, reindeer race
maybe use that dfs to get your min paths lol
so you don't turn too much
i almost certainly hand wrote dijkstra for that one
i rarely use recursive solutions because they confuse me
i can write a bfs with my eyes closed though
i did that day in nim
what is nim?
language
it was the roulette language that day, but i have some prior experience so i did it
ah
I started the roulette last year, but I gave up when installing the languages was too much of a pain to do during exam season
heap.push (0, START, (0, 1), @[])
while heap.len > 0:
state = heap.pop
if state.pos == END:
best_score = state.score
for seat in state.seats:
best_sets.incl seat
continue
for neighbor in state.pos.neighbors:
new_dir = neighbor - state.pos
new_score = state.score + (if new_dir == state.dir: 1 else: 1001)
if scores.getOrDefault((neighbor, new_dir), new_score) >= new_score:
scores[(neighbor, new_dir)] = new_score
heap.push (new_score, neighbor, new_dir, state.seats.concat @[state.pos])
nim looks pretty dope if you've never seen it
it's just typed python
neat
lol
Idk what happened to it
i'm in the mojo server, but i dunno about it
As usual there was a bunch of hype and then it went poof
i really like:
block:
# can make an arbitrary block of code with its own locals
and
discard some_proc_that_returns_something_i_dont_use()
Yeah that's nice
also blocks have a value
I like the rust-style ownership stuff
let a = block:
do stuff to make a
That's one of the nice things about Scala
Conceptually Scala is just so cool, I rarely ever use it tho
I wrote a whole compiler in it and then never again
There's a bug somewhere deep in my O3 flag stuff for it which I never got round to fixing
Otherwise would be cool to do AOC in my own language
i wanted to make a toy array lang
you know how lua, the only collection is a table
like that, but the only collection is array
Lol
A really fun one is "only collection is pairs"
You want a list? Infinitely nest
lol
You want a struct? Sure, you'll need to cough up n-1 pairs my good sir
It actually works decently
You have to do type erasure on doubly nested pairs
But you can get it to work happily
i'm not sure i could get it to work
That's what my lang started with
(a, (b, (c, d))) this reminds me peano
I love peano
because mathematicians think this is a reasonable way to define natural numbers
It's so cool tho
Because it lets you do some really neat stuff in Haskell funnily
You can define a type family for Peano numbers, and you can use the Haskell type checker to write proofs over the peano numbers
And from there you can actually statically type vectors of given lengths and functions over them
It's in the top 3 mindfucks I've ever experienced in that language
haskell too dank for me
Haskell my beloved
Hadn't done it in a while but then I became a TA for the first years in my uni
And the students all learn Haskell in term 1
And it took me straight back to my addiction
see, i have reasonable addictions, like graphics in the terminal
Taught them about circular programming a few weeks ago, that really got em
A significantly more productive addiction tbh
lol, i don't think it's productive, but it's a fun hobby
You end up with awesome visuals that you can use in other situations if they're similar
i get to spam #python-discussion when all you mods are asleep
I end up with 17 folders of eldritch code fragments that would each get me an exorcism if I showed them to a sane person
lol, i actually save a ton of random code fragments
I have a lot of them for Python from helping round here
When people are doing smth interesting and I help them fix it I'll save the cool snippets
same, i actually have a discord folder with scraps of helping people
all my weird maze generations are in there too
!e
import random
from cmath import log
import networkx as nx
def line_char(x, y, maze):
if (x, y) not in maze: return " "
return " ╺╻┏╸━┓┳╹┗┃┣┛┻┫╋"[sum(2 ** round(log(complex(*u) - complex(x, y), 1j).real % 4) for u in maze[x, y])]
G = nx.grid_graph((9, 100))
G.remove_nodes_from((i, 0) for i in range(1, 100))
G.remove_nodes_from((i, 8) for i in range(99))
for e in G.edges:
G.edges[e]["weight"] = random.random()
maze = nx.algorithms.minimum_spanning_tree(G)
print("\n".join("".join(line_char(x, y, maze) for x in range(100)) for y in range(9)))
:white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | ╻
002 | ┃┏━━━━╸╺┳╸╻╻┏━━┳╸┏━╸╺━┳╸┏╸┏┓╻┏━━━━╸╻┏╸┏┳╸┏━┳━━━┳━━━┓┏┳━┓┏╸╺┳╸╺┓╺┓╻╺┳━┓╻┏╸╻╻┏╸╺┳╸╺━━┓╻╻╻╻╻┏━━━┳┓╺┳┓╻╻
003 | ┣┛╺┓┏╸┏━╋━╋┻┻┓┏┻┓┃╻╻╻┏╋╸┣╸┃┣┻┛╻╻╻╺━┫┃╻┃┗╸┗┓┗┓┏┓╹╻┏━╋┛╹┏┛┃╺━┻━┓┣┓┣┻╸╹╺┻┻╋╸┃┗╋━━╋━┳╸╺╋┻╋┻╋┫┗┳╸┏┛╹╺┫┗┻┛
004 | ┗━┓┃┃╺┛╻┃┏╋┓╻╹┃╻╹┃┣┛┣┛┃╺┫╻┃┃╻┏┻┛┣╸╺┫┃┗┻┳┳━┻╸┃┃╹╻┃┗┓┣╸╺┻╸┗┳━┓╻┣┛┃┣╸┏━┳━┓┗━╋━╋╸╺┛╻╹╺┓╹┏╋╸┃┗┳┻╸┗━┓╺╋┳┓╻
005 | ┏┳┫┃┃╺┓┣┛╹┃╹┗┳╋┛╺╋┫╻╹┏┻┳┻╋┫┗┻╋╸╻┣━━╋╋━━┫┗━━╸┃┣╸┃┗┳┛┣╸╻╺━┓┣╸┗┻╋╸┣┻┳┻╸┃╻┗━┳┛╺┫┏┳╸┗┓╻┃┏┫┗╸┃┏╋╸╺┓╺┫╺┫╹┗┫
006 | ╹╹┃┣╋━╋╋━╸┗┳╸┃┗┳━┫┃┃╻┃╺┛┏┛╹┏━┫┏┻┻╸╺┛┃╻╻┗━┳┳╸┗┛┏┛╺╋╸┣╸┗┳┓┣┻━┓╺┫╺┛┏┫┏╸┃┃┏╸┗╸╺┫┃┗┓┏┻┫┗┫╹┏━┫╹┣━┓┗┓┗┓╹┏━┫
007 | ╻╺╋┛┃╺┛┣━━┓╹┏┛╺┫┏┫┗╋┻┻┓┏┻┓┏┛┏┻┻┓╻╺┳┳┫┃┃╺┓┃╹╺━━╋━┳┻╸┣━┓┃┃╹╺┓┣┓┃╺━┛┃┗━┫┗┫╺┳┓╺╋╋╸┗┫╺┻┳┫┏┫┏┛╺┛╺┻┓┃╺┛┏┻╸╹
008 | ┗━┻╸┗╸╺┻━╸┗╸┗╸╺┛╹┗╸┗╸╺┛┗╸╹┗╸┗╸╺┻┻╸╹╹┗┻┻╸┗┻━╸╺━┛╺┻╸╺┛╺┻┛┗━━┻┛╹┗━╸╺┻━╸┗━┻━┛┗╸╹┗━╸╹╺━┛╹╹╹┗╸╺━━━┻┻━━┻━━┓
009 | ╹
nice
Hah neat
don't look close at a complex log
I'm trying not to
Ok it makes some semblance of sense, I'll look at it more in the morning
It's 2:30 and I've been on mobile for the last 2 and a bit hours so sleep would be reasonable
that line char function, i ended up using it for #games message
which is what i'm trying to port for today's vis
to link the gates
Ah right
making it prettier though
That should be a fun one
I could talk all night so I'll have to stop somewhere, catch ya later! 👋
see ya cheeki, thanks for the help
gn
Happy Halloween 👻
christmas creeping ever closer, and i dont' feel like i'm any closer to solving d21p2. i'm so sorry chief historian
how close are you
i'm not sure. I can show you what i have if you want to take a look
this looks close, i would modify the cost function a bit
@cache
def cost(path, robot: int, keypad_type: str):
all_paths = (best_paths(a, b, keypad_type) for a, b in pairwise("A" + path))
if robot == 0:
return sum(...)
return sum(min(cost(..........))
messed up last line, but it was supposed to be a hint
why ||robot == 0 as the base case?||
so you can start at 25 and go downwards instead of going upwards
how does that work? doesn't the initial call have to be with the door code? how would i know what the path is gonna look like at the top level?
the function doesn't care if your initial call is labeled 25 or 0, but it's easier to know when to stop if you count downwards (you recurse with robot - 1 instead of robot + 1)
oh i see
(this also lets you use the same solution for p1 by calling it with 2 instead of 25)
i'm confused by your path variable, is that just the start and end buttons?
no, it's the entire path, it's a string, will be like "123A" or "^>>A<<<^A"
ah
Btw not really related but I like your keypad formatting, probably the best use of non-PEP8 dict formatting I've seen
oh thank you haha
if* i solve lol
i hope so, my brain is mush after day 24 so it's hard to tell anymore
been mush since that base 8 puzzle
Tbh that one wasn't too bad
lol yea, that one took me like 24 hours
honestly, after i understood it, it seemed so obvious to me
that's what's so annoying about it
i sorta had an idea to solve it pretty quickly, but i spent a lot of time decompiling the machine and looking for more simplifications just out of curiosity
i wasted a ton of time thinking that i had to ||partial match against the start of the output. took me way too long to realize I had to match the last output first||. so dumb
Yeah I just ||decompiled it, realised it was a loop, then condensed it||
That one made sense to me
Yesterday's took me a lot longer to spot because Digital didn't give me a useful diagram
Anyway GL all
gl
Btw what position are you on pydis, salt?
no idea
i have this now, seems wrong still:
||```py
@cache
def cost(path: str, robot: int, keypad_type: str):
all_paths = (best_paths(a, b, keypad_type) for a, b in pairwise("A" + path))
if robot == 0:
return len(min(all_paths))
costs = []
for path in all_paths:
costs.append(cost(path, robot - 1, "directional"))
return min(costs)
It's definitely still wrong, ||min(all_paths) will select the first alphabetically, not the shortest||
fine for base case, but all_paths is Iterator[list[str]] so what you want is
sum(len(paths[0]) for paths in all_paths)
for base
since it doesn't matter what path you take (they're the same length) for last robot
hmm
*all_paths, not all_paths()
oh yeah
And also your min(costs) might as well be a genexp
i dont think im getting lob today gl yall
should i be appending "A" to the end of the path when returning a path from best_paths? i'm confused by that
yes
and also prepending it when passing it to best_paths?
best_paths(a, b) should move from a to b and press b
Yes, because you'll always be starting from an A when calling it
i see
(and you need to press the first button in the path)
this year's been fun
20 seconds
good luck guys, thanks for the help salt/starwort
<@&518565788744024082> Good morning! Day 25 is ready to be attempted. View it online now at https://adventofcode.com/2024/day/25. Good luck!
truly is advent of grid
29/14 🥳
30/13
overtook for p2 😈
89/69 🎉
I screwed up my grid mapping because pylance actually I think it's Ruff's fault was unhappy
I hesitated for a second because I forgot 😩
lol happens
so I basically tripled my points today
looks like i'm confirmed #8 global
Something I'm curious about is what libraries everyone used
ok
I might make a google form to try to graph it
numpy = "^2.1.3"
sympy = "^1.13.3"
scipy = "^1.14.1"
networkx = "^3.4.2"
z3-solver = "^4.13.3.0"
pandas = "^2.2.3"
more-itertools = "^10.5.0"
shapely = "^2.0.6"
along with my own
the only one I used this year was pyperclip to copy the answer for me :p
prob coulda have had 1st in lb this year
I meant AoC libraries specifically - AoCD, aoc_helper, aoc_lube, etc.
if i wasn’t flying
I'll write a google form so I can graph it
oh in that case it's my own library
i have my own lib as well
honestly its probably worse than a lot of the public ones out there, but its what ive used since like 2019 so its mine 🥰
i accidentally split on \n instead of \n\n and then just kinda gave up on going fast and took my time
still got sub 1000 tho which is crazy
considering i took 11 minutes
😔 I started the question 8 minutes late today. Rank #727
1072/954
Global rank #40
crazy
That's only in that leaderboard - the aggregate one you can check with &aoc lb (if you've used &aoc link)
its still day 24 gang
...no?
US era

You know, I didn't even notice the easter egg for day 19 at the time lol
i wish i did AOC this year but i just forgot about it being busy
wow i completed the last day in under 20 minutes and still didnt place global lb 😂 happy holidays chat
I like that the easter eggs are mostly dev commentary this year
Did part 1.
25 more stars to go 🙁
Welp, better luck in, iunno, March or something.
I was wondering how f.readlines(7) does not read 7 lines
@mossy basin you still in a helpy mood? lol
sure
haha
well i have this now, still something definitely wrong, but am i going in the right direction? https://paste.pythondiscord.com/XOLA
some type hints are wrong, ignore that
gotta fix this
costs = []
for paths in all_paths:
costs.append(min(cost(path, robot - 1, ...) for path in paths)
5.5 ms on execution time sheesh
appending too many paths
and then sum the lengths
well, you don't need to do that
that's handled in base case
how am i appending too many paths?
like that
oh no, ok that is definitely better
doesn't give the right answer, but it's close i guess
i think you might need to switch your keypads
but i'm not sure
maybe not
but maybe, try to use numerical when you're at 0 and directional elsewhere
see if that works
cost("029A", 2, "numerical") returns 62, which should be 68 i believe
no that doesn't make sense
do you have to complete all days to complete day 25? i read someone said that
can't even do the first input without a numerical
yes
yes
overtired
i replied to the wrong message lol
this is staring me in the face as i race to finish d21p2
can i give you my paths function to test, just to see if thats where the error is
sure, for science
i think your paths are correct, but i'm not 100%
@cache
def paths(a, b):
(uy, ux), (vy, vx) = NUMPAD[a], NUMPAD[b]
dy, dx = vy - uy, vx - ux
path = f"{'v' * dy}{'0' * -dy}{'>' * dx}{'<' * -dx}"
paths = []
if ux != _X or vy != _Y:
paths.append(f"{path}A")
if dy and dx and (uy != _Y or vx != _X):
paths.append(f"{path[::-1]}A")
return paths
oh shit, my numpad is different
hmm
NUMPAD = {
key: (y, x)
for y, row in enumerate(["789", "456", "123", "_0A", "<v>"])
for x, key in enumerate(row)
}
_Y, _X = NUMPAD["_"]
well, can do this an ignore the keypad
could not imagine placing lower than u ❤️
/j you did really good this yr holy shit
wow ok, with your paths function i get 68
i didn't expect my paths function to be the problem, i wonder what it is
ok, i think the holes check might be off
let me think about it i guess
if i'm capable
lol
dy, dx might have wrong sign
what do you mean?
dx = sx - ex
dy = sy - ey
try
dx = ex - sx
dy = ey - sy
wow, that gave me 68
k, thought so
i like triple checked that, i really thought that was right lol. my brain really is mush
end - start, b - a, etc.
i got it, dude, thank you @mossy basin. merry freakin christmas
i got stuck on day 22 2015
i'm still so upset about 2020. that one picture rotation puzzle is impossible
oh shit, is that the one i used cv2 for
lol what is that
ah
i was thinking of day 19 2021
M = cv2.estimateAffine3D(b.coords[ks], a.coords[js])[1].round().astype(int) used a real higher-level function
That was underwhelming af 😂 had better event endings in Fortnite this was my first year participating
Guess you'd better stick to Fortnite
Pfft did you even make it to global lb I did
do year 2019
ending is sick, whole year is a masterpiece
Ill code out 2019 n try it
for what it's worth, day 25 usually isn't supposed to be hard, to give people a break on christmas morning. But 2019 day 25 is definitely not trivial
I wanted to code out 2015 the first aoc event
i think 2019 day 25 was the only time i broke top 100
because i just so happened to solve the rpg maze with first guesses
Appreciate that coming from you! 😭 ❤️
I sure did. I can't believe it myself
Last year I could barely do the first 2 days and this year i got 39 stars. I will definitely take that 
congrats to everyone and see you next year i guess
edit: oh and also, merry christmas
F
nice improvement!
hi guys
ola
gotta catch em all
i need 4 more 😭
day 17 part 2
day 21 parts 1 and 2
day 24 part 2
all the cancer days
21 p2 being the most demonic
im stuck here too
i cant be bothered, its all so tiresome
you could probably do day 17 part 1 with little trouble
i don't even understand what they want from me
part 1 is just implement VM according to instructions and feed it your input.
vm?
a virtual machine. that implements the operations detailed.
or an interpreter, if you'd like.
i thought about just lambda ops, tried to do in manually but i dont get right answers. For example Program: 0 is A = 729//2**0?
you can't just have program 0, since the opcode 0 needs to be followed by an operand
f that problem
||skill issue||
wow
I’m doing aoc 2023 now in rust I’m on day 10
After aoc 2023 I want to do aoc 2015 in c
either 17, 21 or 24p2
24pt2 was a "screw it, I'm doing it by hand" day for me.
that was a really tough one
Still missing 21, 23 and 24p2.
😦
Ugh. Day24 part2 was a nightmare. Over 100 lines longer than my next-largest solution. So many false starts, plus several failed attempts to have a plotting library generate the circuit to help me understand it. But I finally managed it, and thus got all 50 stars.
Let's go fancy role
woohoo
Truth...
unlucky
Your former admin role covers your Completionist role :(
I can maybe see if I can shuffle it higher if you prefer being pink
haha it's ok
thanks though
am i pink
Lol... Was just now trying to find this Discord in my list and could not find it. Thought maybe it got removed from my list or something. Nope. It just lost its AoC decoration.
I forgot about advent of the code
yay I am pink
yay
same im gonna marathon through them all sometime this week
I kinda want to try speedrunning an entire aoc year
this is real fun to play with

gms
this is sick
Can it be used to build a latch?
what's a latch
probably talking about a flip flop or w/e
SR latch, that's what i'm thinking of
can you make this connection?
why do the gates have 2 outputs? 😔
because i need to connect a XOR to both a XOR and an AND to make the adder
so i just gave them all two outputs
i guess those are NAND gates, you wouldn't have those
i can make them, but can i do it with other gates
maybe?
i don't have a not either
i feel like you can make anything with what you have, it just may be somewhat complicated. I'm certainly no expert though
apparently you can construct any other gate using only NAND gates, which is interesting
i get a recursion error when i connect output of gate 1 to input of gate 2 and output of gate 2 to input of gate 1
because i wasn't thinking about that when i made this
i might make this a separate tiny project though with more features
cause it's fun to play with
it's what makes redstone in minecraft so much fun
I guess ideally it should be one output connector you can connect to N inputs
or a separate splitter
just an option to split any wire
at some point
then i could have 1 output
the wires can't be interacted with though in this visualization, that's another thing to add
Why not make a splitter, accept 1 input and split them into 2
But I guess it is just for convenience because of the puzzle anyway
i just said that
you should make a splitter
lol
you could make a NOT with an always true value and an XOR```
true: 1
input: x
input XOR true -> NOT xso a NAND could be
true: 1
a: x
b: y
a AND b -> z
z XOR true -> x NAND yor
a: x
b: y
a AND b -> z
NOT z -> x NAND y```
XD
😄
👍
ok endboss for me: day 21
it was a real doozie for sure
nah we're all gone
umm
i've already added myself
like a while ago
did you finish this year's AoC?
You need to have all 50 stars on the account that you linked
pink is nice, but that orange 😄
Is there a role command? Interested in how many people have the role
1191547731873894440
#f87dc8
0.90 0.50 248
51
68
0
Nice, thanks Kat
I’m doing advent of code 2015 in C 
congrats everyone on all puzzles solved this year!! 
do we have a way of compiling stats on this? number of users that participated each year, number of collective problems solved, etc
our leaderboard should have those stats
i think we have several pydis leaderboards that we combine but yeah would be nice to see some trended visuals
<@&831776746206265384>
!cban 933714120681857036
:incoming_envelope: :ok_hand: applied ban to @boreal ivy permanently.
I bit off more than I can chew chat
I can pull the stats on this from each year and have the dataset available for people to do some interesting analysis. I can probably get that data either today or by new year
i read that as "by today or by next year" and thought "huh that's a pretty big time range"
using any libraries for data structures? Things get a lot easier if you have at least a reusable dynamic array and a hash table...
I just finished building out my workflow environment phew 😅 it was a pain. Just need to test everything then I’m good to go on daily challenges
You assemble a list of leaderboards from previous events (your puzzle input). For example:
mfw the finish times are really coordinates and velocity in a grid where you simulate trajectories to see at which time everyone align to spell a message
After some time, everyone joins together to form the python logo. When is the first time this happens?
guys, how long will the website adventofcode.com be up? I would love to do all the challanges but I don't have much time nowdays
Its always going to be up
What @ripe meteor said. And if you want to check out the previous challenges, you can modify the date from your browser.
Ooh, alr thanks
Sorry didn't notice your message
or press Events in the header
it's also a pretty sight
i think the years being green and the stars being yellow was intentional
looks like a budget christmas tree
Sheesh 👀 did you complete em all in 1 language? I want to try a different language per year
2018-2020 python, some c++
2021-2022 rust
2023-2024 roulette (25 different languages each year)
best time to start is now. sheesh i am cooking in C i literally am building tools to help me in aoc
Y'know, I haven't tried Advent of Code yet. Should I go try it for fun?
I want a break in "monotony"
yea its the holidays pick a programming language youd have fun in
python is too cracked for aoc
Okay, I'm pulling data now. Are y'all just interested in the general leaderboard data or would you also like per-day data?
Ah it turns out the AoC website just gives you everything anyway. Have fun parsing =P
Python Discord Leaderboard Data
Attached is a zip file with the leaderboard data from our 9 community leaderboards for all years since Advent of Code has started. There will be duplicate members across multiple leaderboards, handle that appropriately. File naming structure is Year-LeaderboardID.json.
YEARS = (2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024)
LEADERBOARD_IDS = (957532, 645282, 968271, 274879, 422097, 512551, 631135, 1436883, 74242)
or do just sum across all leaderboards, my star counts will look amazing
hi
According to the data, 8 named people across all pydis leaderboards have all 500 stars:
nitekat
MBoffin
Defelo
Starwort
algmyr
Allan Taylor
Edward Keyes
Kevin Sheng
Goats
🐐
I got to day 5 aoc 2015 in C 😏 I may not finish 2015 before school starts again
I can't solve day 24 of 2024 aoc
I solved it by hand. Literally.
Can you explain it a little?
do you know what a half-adder is, and what a full-adder is?
I know. So what

