#advent-of-code
1 messages ยท Page 51 of 1
(||looking at you, string-based solution for day 18||)
||day 18 counts - the calculator from last year does as well||
what day was that
very satisfying to see the various ways people attack the same problem
ngl
the o2/co2 day was kinda fun
it can't just be a coincidence that two calculator-esque questions were on the same days on subsequent years, right?
||2019 d18 - i'm looking at you, eval||
anyway, yeah, very much enjoyed seeing solutions to 2020 d18
how curious
pretty sure you mean ||2020||
i jsut noticed
oops, yea
2019 was my arch nemesis - keys and doors
yeah, still don't have a nice solution for d18 of 2019
I think I have a working one, but its super slow
||not directly, but I did enjoy seeing the solutions were people changed the string and then eval-d it ||
such solutions I call "jank solutions"
does my bingo solution of using a sed script to produce a mathematical expression that evaluates to the result count?
||creating a class to hijack the dunder methods according to the order of operation they need, then using a string replace to change the operator and insert the class invocation|| was my favourite
I tend to consider solutions that work directly on the string as jank, yes ๐
what day was the co2 scrubber day
||yeah thats what im talking about||
day 18 took me 5.5 hours. never looking back again lmao
now i've already achieved my goal, so every single puzzle i solve now is a bonus
day 3
day 20's part 2 is kinda bruh
i felt like 19 was like that too
when the part 1 of a day is too easy, you just know part 2 is going to be crazy
figured out the main conceptual "trick" in 19 immediately, but nailing down all the crap, especially the rotation related stuff, was annoying.
And harder to visualize bugs compared to 18.
y2020d20 type beat
day 19 honestly looked a lot harder than it was. Though my solution was kind of bad
funnily enough, I found 18 harder to visualise bugs. Because my code was breaking on the complex examples but those were not broken down into steps, so it was a pain to figure out
maybe not so much hardness, just very tedious code to write
18 I had fun solving for the second time in haskell
with ||recursion||
as is proper
everyone complains about this one, but I never found this one difficult, just tedious. I always knew I could do it, just that I'd need the entire weekend-day to do so
on the other hand, I struggled with one that most people did not that year - 2020 d23 part 2
the problem is that AoC isn't mandatory, so if something is tedious to do, I put it off, and stretch it out even more
that's what happened with 19; at some point I just put off writing some 20 lines of code for hours, even did day 20 before 19
more people have completed today's solution compared to d19
what's the day that the fewest people completed
at the moment, for this year, still d19
hmm, ||P2 today|| has been the hardest for me so far tied with D19
just like y2021d19 tbh
okay, glad I'm not the only one who thought 19 was the most annoying so far ๐
hmm
yeah, looking at things, short of my early gurklang solutions, d19 is by far the most code I wrote for a specific day.
my 18 was actually longer
but a lot of that code was pretty similar to each other, and not that hard to get right, I just didn't see an easy way to factor it out
like next vs previous on a binary tree with backlinks
didn't take me long to do, but it's a decent number of lines, and then you copy and paste and swap left-right
my 18 is quite a bit shorter, but I did the ||token stream|| solution
yeah I figured
with the recursive solutions, you end up writing quite a few recursive functions that are not completely trivial
Yeah if I hadn't done the ||flat|| solution I would have found d18 much tougher
though my ||singly linked binary tree|| solution is also shorter, though that's probably just haskell being haskell
probably; i'm not actually even sure how that solution looks tbh lol
all the ways that I could see to do it without backlinks seemed worse than backlinks
I'm going to orlando for vacation stuff with the wife and kids now, so basically not going to be doing much over the next 5 days and will probably fall way behind ๐
essentially, I return ||an optional value of type (left value to add, new subtree, right value to add)||, then use the ||call tree to keep track of where to insert the value on either side||
yeah, I'd probably need to write it out in a non-Haskell language to really understand it
I think D21P2 wasn't a whole lot tbh
this is kind of pretty for handling the conditions
is 15 hard?
I looked at the maze and it's not really obvious to find the solution at first glance
depends on your background
depends
if you have never touched ||pathfinding||, yes, it may be a little hard
if you are familiar with ||graph theory||, it is rote, if not, it is an interesting challenge
LMFAO I COMPLETELY OVERTHOUGHT DAY 20
it was a relaxing puzzle
naive solution (||actually simulating the enhancements one at at time|| takes only 13 seconds)
yes lol
although i will try to find a better solution later on
there isn't really a better solution
just not today. Soon โข๏ธ
wait actually?
yeah
||so the optimal solution is to just simulate the enhancements?||
I do think you could use one of the fancy ||cellular automata|| algorithm, like ||hashlife or quicklife||
the best you can do is ||using sets instead of lists||
Yeah I'm not too familiar with that concept
which shaves off like a single second
oh wow, i didn't know that. why are sets faster than lists?
you don't allocate as much and resize on the fly
ah, well i'm not familiar at all with cellular automata
although that's why you should pre-allocate your 2D arrays
if you do there is no real advantage to sets
if you ||use a library|| then it's not hard at all
i did this, does this count as preallocation? ||new = [[0 for _ in range(depth + 2)] for _ in range(width + 2)]||
yes
I think the fastest solutions were just ||bigxbig arrays that just got slightly wrong as time went on, but were large enough that the information wouldn't reach the area of interest in time||
||or maybe they shrank with invalid values||
lol i don't understand that, ||are you essentially deleting unuseful info?||
it wasn't a hard challenge
I'm interested in udnerstanding the concept + approach
the hardest part was figuring out in which order you should look at neighbours
the ||speed of light is 1||, so you just need enough ||space to delete all the leftovers without affecting the relevant simulation||
Especially if they ask about it in coding interviews
||There's a Python library called networkx that will do d15 for you, both parts||
leftovers?
I like my solution, just ||generate files and run the automaton in golly||
||Just feed the input in and request the shortest path distance||
||the borders will generally cause some error, you have to somehow deal with that||
My solution for d15: ||https://paste.pythondiscord.com/bugexumifa.py||
||oh, i just used default values that alternate each iteration (due to the infinity toggling)||
||that also works||
||That ones comes with scipy. I haven't tested it on the caves yet||
||It takes time and memory, but you save on developer time lol||
I just ||handrolled dijkstra|| for d15. Nothing ||too elaborate||.
same, with ||A*||
The regular solution isn't difficult by any stretch, and is faster and less memory intensive, but ||you can't beat a single function call for simplicity||
yeah, I was just curious if I still remembered the algo
||can't-implement-dijkstra moment||
also some say that ||adding a manhattan distance heuristic for a* doesn't save many searches in this problem. is it true?||
speaking of which, i shall re-attempt day 15 now
i just don't know why my ||a* and heap|| is so slow
yeah, I found ||A* to be a minor improvement at best||
I doubt it's as slow as my solution ๐ how long does it take for you?
next year I may do less than 1 second time limit for all days just for some extra challenge
maybe finally learn rust properly
over an hour, so out of sympathy (but more realistically, impatience) i burned it down
ouch maybe not then XD
I thought my solution at 6.6 secs || with the library|| would be the slowest
||library one-liner lmao||
yall know that when you scroll up, like 50% of the text on this channel is blotted out right ๐คฃ
Advent of REDACTED
probably people should move their convos to the spoilers channel more often, it's less effort
|| Well, Black formatted it for multiple lines || ๐
i was about to say that 
I wanted to use AOC to learn C or C++ but I think I'll finish the thought process in Python first before adding extra steps like malloc and such
in terms of learning C++ properly, I'd pretty strongly recommend against that
if it's just for fun then it doesn't matter of course
for D15?
yup
which part
both together
I heard C++ wasn't very suited for that kind of algorithm unlike C
err C++ is definitely better suited for AoC than C
we're at like 8s for a pure python A* implementation, so that's not so bad
having a hash table available in the standard library alone, is an automatic win
AoC in C sounds like death
yeah, I wouldn't enjoy that
I suppose we have to construct everything from scratch with vanilla C using the structs...
I think Python is really excellent for the AoC
Python is comfy
well, writing a hash table from scratch is no joking endeavor
maybe you could port some of the code to another language if you really want fast solutions
that would be a harder question than most things in AoC.
but like I'm happy with anything that runs in less than five minutes
and then in C, you don't have generics, so you'd have to copy and paste your imlementation every time you wanted to change the key type, or else learn how to use macros
I think my headmates have higher expectations though
I'm happy so long as I get the answer ๐
I am not above waiting an hour if I must (though obv want to avoid that)
That's why I decided to do write on Jupyter Notebooks for 2020 and opt for scripts + testing this year
lmao perhaps this is why my ||a*|| is so crappy
<@&831776746206265384>
!pban 639198305854947339 cya
:incoming_envelope: :ok_hand: applied purge ban to @undone osprey permanently.
I'm stuck on day 19. I can't figure out how to iterate all the different orientations a scanner could have. I can visualize what they are, I just can't think of how to step through them without having a list of pre-computed rotation matrices. Can someone give me a hint?
||maybe go on a site like geogebra which has a 3d graphing tool, place a point in the graph, and rotate the graph. then, try to figure out how to take the xyz coordinate of that point and switch variables around to get to that new point that you get from rotating the graph||
in short, ||for each point in the scanned points, swap the values around||
sure, ||you'd end up with a list of a bunch of different combinations of the coordinates, but i'm wondering if there's a way to iterate them without creating that entire list by manually||
||as far as i know, such a method doesnt exist. but its not a huge list to implement, and it runs in a reasonable amount of time for both parts||
ok, thanks
this channel is about Advent of Code. #python-discussion is good for other questions.
Sounds good thanks.
heyo
I've actually also done every single challenge also in C
I'm not going to lie I've enjoyed it a lot
It's sort of a different puzzle on its own, how to get stuff working without all the conveniences of Python
But maybe I just hate myself ๐
well yea thats just programming in a nutshell
<@&518565788744024082> Good morning! Day 22 is ready to be attempted. View it online now at https://adventofcode.com/2021/day/22. Good luck!
oops
๐ฉ
heh 420
.aoc leave
**```
.adventofcode
**Can also use:** `aoc`
*All of the Advent of Code commands.*
**Subcommands:**
**`about `**
*Learn about Advent of Code*
**`countdown `**
*Return time left until next day*
**`join `**
*Learn how to join the leaderboard (via DM)*
**`link [aoc_name]`**
*Tie your Discord account with your Advent of Code name.*
**`subscribe `**
*Notifications for new days*
**`unlink `**
*Tie your Discord account with your Advent of Code name.*
**`unsubscribe `**
*Notifications for new days*
.aoc unlink
You don't have an Advent of Code account linked.
.aoc unsubscribe
Hey, you don't even get any notifications about new Advent of Code tasks currently anyway.
i wouldnt consider myself very smart, but cant i just ||find the number of on cuboids as if it were a 1d list, then cube that||?
@random solar I think that's what #aoc-bot-commands is for.
Oo , sorry
^^
nvm i just realized ||instructions arent always perfect cubes||
oh well today doesnt seem too difficult
famous last words
ok im scared
bruh today was not a good day
I haven't joined yet, but after signing up, how do i join this servers leaderboard ?
Do .aoc join in #aoc-bot-commands, and the bot will DM you a private leaderboard code, which you can enter in Leaderboard - Private Leaderboard
(there's many more than one leaderboard because everyone won't fit into one, hence separate codes for separate people. The .aoc lb and .aoc daystar commands, however, aggregate all these leaderboards into one.)
ok so I am trying out the 1st puzzle
so you don't run the code on the website
how do we get the input for our program then
Yea I pressed it, it's just text there, so i gotta copy and paste it to a text file and create a program that reads from it and does stuff ?
๐ .
either you copypaste it, or you save it as a file, or you can have your program download it (if you know how to do http requests)
haha fine, so the site needs just my answer, not code
yup, it's a language-agnostic challenge for this reason
in theory you can solve some days without programming at all, if you're willing to do a ton of calculations on a piece of paper, lol
ha, so what determines our scores and pos on the leaderboard ? time taken to solve it ? and if someone joins late, can he still top the lb, because the relative time taken was less
its time from puzzle release
and if someone joins late, can he still top the lb, because the relative time taken was less
nope
that'd be impossible to do - what would stop anyone from misleading about when they started solving?
so it's just from start of challenge.
or just getting someones script from github
it would theorhetically be possible to have a script download someones scipt and solve in a matter of seconds if you could join late and have the scoring be relative
yea, i see
if you have friends who are also joining late you could make a private leaderboard with them, otherwise its just for fun
there are also 3 days left excluding today this year
.aoc subscribe
Hey, you already are receiving notifications about new Advent of Code tasks. If you don't want them any more, run .adventofcode unsubscribe instead.
.aoc unsubscribe
Okay! You have been unsubscribed from notifications about new Advent of Code tasks.
๐
.aoc lb
:x: Please use #aoc-bot-commands for aoc commands instead.
Yup, it is preetttyyy painful
.aoc
**```
.adventofcode
**Can also use:** `aoc`
*All of the Advent of Code commands.*
**Subcommands:**
**`about `**
*Learn about Advent of Code*
**`countdown `**
*Return time left until next day*
**`join `**
*Learn how to join the leaderboard (via DM)*
**`link [aoc_name]`**
*Tie your Discord account with your Advent of Code name.*
**`subscribe `**
*Notifications for new days*
**`unlink `**
*Tie your Discord account with your Advent of Code name.*
**`unsubscribe `**
*Notifications for new days*
Advent of Code (AoC) is a series of small programming puzzles for a variety of skill levels, run every year during the month of December.
They are self-contained and are just as appropriate for an expert who wants to stay sharp as they are for a beginner who is just learning to code. Each puzzle calls upon different skills and has two parts that build on a theme.
Sign up with one of these services:
GitHub
Google
Twitter
Reddit
For the global leaderboard, the first person to get a star first gets 100 points, the second person gets 99 points, and so on down to 1 point at 100th place.
For private leaderboards, the first person to get a star gets N points, where N is the number of people on the leaderboard. The second person to get the star gets N-1 points and so on and so forth.
Come join the Python Discord private leaderboard and compete against other people in the community! Get the join code using .aoc join and visit the private leaderboard page to join our leaderboard.
I see what they want us to do for today
but who said naive wasn't going to work, right? 
fish: Job 1, 'time python day_22/part_2.py' terminated by signal SIGKILL (Forced quit)
yeah
have you noticed there are 420 instructions for today?
Another hard P2 today?
yeah I'm already struggling wiht part1 since I am kinda guessing what part 2 is
but who knows
If someone could give me a hint for day 15 part 1 that would be nice. I want a hint not a solution, i feel like i am so close but all my ideas have problems with them.
It's pathfinding - ||Dijkstra, for example||, no hidden traps there. If it doesn't work, ||make sure you're consider steps up and to the left||
||calculating 3D overlaps... bruh||
still better than Beacon Scanner ๐ฅด
lmao
||i might try to come up with a mathematical solution by playing with 2D rectangles first||
||then making a generalized result for nth D ๐ฅด ||
||because there is no way I'm iterating through sets of millions of 3d coords and finding overlaps||
but yeah, I really love aoc
I've never even touched working with 3d before (nor parsing, nor pathfinding, nor recursion in an actual project)
So these puzzles are amazing
lmao
I've alwso been doing some weird stuff
I think I am close to a pretty nice solution tbh
But I'm missing like one step
Are there any example images for Day 20 (Part 1) ?
My code works for the official example, but not the actual input. Another example might help me debug it.
The main caveat is that in the actual input, ||first character of the algorithm is # unlike the example||.
To add to this, if you were to change the example ||so that the first character of the algorithm becomes # and the last becomes ., the answer becomes 24||
Thanks, i'll test that
Ohhh, I see: || reversing the first and last character in the algorithm makes the 'infinite' outside of the image toggle, which influences the outer bits of the image. So I have to pay attention to a bigger area than I thought.||
As the prompt says yes
Part of the task p1: ||Through advances in imaging technology, the images being operated on here are infinite in size. Every pixel of the infinite output image needs to be calculated exactly based on the relevant pixels of the input image||
Is a bit mean tho
Anyway I'm struggling again cause I'm overcomplicated it but I am sure this should work and I kinda want to continue it instead of doing the simple solution
if p2 today does not requite overcomplicating it i'll be sad
part2 today is pretty horrible
Okay maybe I'm doing it fine then
I'd put it as the second hardest day so far, first one being Beacon Scanner of course.
I could solve p1 easily but I want to do it in a stupid complicated way
inb4 I do it but it's still useless
:(
inb4 p2 is something completely unrelated and I'm just dumb
Maybe I should just solve p1 the easy way
<_<
Up until Day 17, Day 15 was the hardest for me so far (Part 2 still not done). And I skipped 18 and 19 for now, because they scare me xD
day 19 gave me a lot of paion
today seems ok so far but I still haven't finishde part 1 since I am forcing myself to do it in some "smart" way
:)
||that's a good idea tbh, you'll be stuck with trying a smart way either way with P1 or P2||
||if you do a smart, fast way now you'll be set for P2||
who uses github copilot
my whole life i've been taught the word "rectangular prism" for boxes lmao
"cuboid" is way better
did anyone else get around 39764556457144 for D22P2 on the sample input?
woohoo, time to whip up an inefficient naive solution!
okay, there's no chance that the naive solution could solve p2 then ๐คฃ
lmao noope
why 3d math ๐
oreo had a challenge to generalize orthotope overlapping to nth dimensions
The answer to the sample for P2 is ||2758514936282235||
wonder who would be crazy enough to do that
I mean I could add any dimension at any point to my solution
if only I can get the final logic to be working
Send help
cc: @mossy basin
challenge from me and @woven oriole: generalize day 22 and create a function for n-orthotope overlapping
I've lost all motivation for today
My logic shoudl techncially work but idk
that one part seems so complicatged surely that isn't it
:(
programming in a nutshell:
I never tested it since I never finished it
I just keep finding more edge cases that I don't cover and I scrapped it like twice already
Lol
At least I'm pretty good at imagining a cube now ig
||i'm sure line-sweeping works in the general case||
||not sure if i'll have time today to write a 3d sweeper||
||but you sort the coordinates on each axis along with on/off information, each time you pass a point where the on/off changes you emit a new cube||
did not know this was not spoilers
||Optimisation problems already dial down my enthusiasm, even worse when it's something totally outside of my wheel house, like 3 dimensional coordinate fudging.||
I can sort of visualise what I need to do in my head, but I have absolutely no desire to work out the math. So P2 is probably not happening - at least not today.
I do still want to do it though
first year wherer I do everything on same day has to be this year
I had one idea that would probably remove a lot of math
but make it a lot slower

not sure if worth
not as slow as naive I'd assume
That was a fun one haha because someone else did it for me
but still slower
naive is literally impossible
I tried p2 example using my naive code... made a lot of noise for a while and my computer killed the process lol
it takes a few millennias to run
Still haven't finished p1
since I thought naive is pointless anyway
looked obvious to me lol
I think it is good to do the first part naive if the optimized version isn't obvious
gives you a feel for the problem
I knew what was coming when they mentioned the ||restricted 100^3 volume|| still did it the bad way hoping I was wrong ๐
continuing onto the harder challenges made us reach place 80 lmao
Yeah I guess me just not doing part1 is going to hurt my leadearboard place
but I never really cared about it anyway so whatever
Did you ever manage to find the bug?
i agree. i always naive first instead of jumping in right away trying to find the clever solution
isnt it ||101 ^ 3||
indeed, but you get the point (aha)
nice.
I think I fought wityh a function
that waas acutally really trivial
I feel dumb now

am I dumb or is this really not that hard
Well one more step
usually they get easier during the holidays, no? i assume 24 and 25 will be a day 12 - 16 level question
ok
Seems like a virus to me
Randomly posting it in a channel does not make it very trustworthy
sandbox time
!mute 913243080302411806 
:incoming_envelope: :ok_hand: applied mute to @wispy onyx until <t:1640201978:f> (59 minutes and 59 seconds).
christmas hat on fractal? so festive lmao
exactly, smh
hey did you finish today yet
no lol
i'm playing around with rectangle overlapping in 2d
i would assume so, but ive been told that's not the case
Overlapping stumped me for a logn time
but I think I figured it out
now I just need the rest
:)
ggs!!
theres ||an easier way that involves subtracting the volume of intersections and adding back the total volume if its an on cuboid||
day 24 wasn't really hard either
just 3 days left
Same
except I still didn't finish today
lol
motivation where are u
What
array has exactly 2 values
I ask it to unpack 2 values
too many values to unpack

print array out then
I think it's cause it's not a 2d array
Weird

what did I create
what is this
Infinite arrays ig
Oh
a.append(a)
You're allowed to do that huh
tuff day ๐ don't even have an approach yet
you just found out about python's guard against recursive containers!
Huh
Also i thought I was doing something not that bad
but it appears that is not the case
apparently my solution is absolutely terrible in performance

or in an infinite loop
one of the two
I'm gonna guess the 2nd

i haven't even found a solution to the 2d version of this problem yet lmao
I think my thing should work but uh maybe it doesn't
hey yall
I managed to amke my solution count -1 million cubes without a single "off" command
do you think i can keep my global lb
with like 780 points
What does keeping global lb mean
Oh
Hmmm
Honestly posibble
Doing more is more safe tho
at least day 25 ig could help?

usually quite easy though that doies mean others also have a chance which could k ick you off with random 100s
my first off appears at 225...
oh, as in 225th instruction lmao
420 instructions
oh, i thought you meant first off after initialization procedure
your (or, at least my) worst nightmares
I mean I'm solving part 1 in how I think I have to to do part 2
are you trying to find a clever solution to part 1? i would recommend start with the naive sol first
now if I can get it to actually work tho
ah, yes
eric wastl if you're secretly in this server make the next few days a lot easier please ๐๐๐
I MIGHT HAVE FIGURED OUT ON/OFF OVERLAPPING
pray to the aoc gods and the superior eric
Not going to lie this is annoying me maybe more than the beacon issue
since I constantly feel like I basically know what to do but at the same time it just isn't right
I must be close but it's just not right
Also it has the same amount of barely any examples
so that's col
send help
share code on spoilers
I've scrapped it again cause it was dumb
also I noticed something funny
:( :( :( :( :( :( :( :( :( :( :(
My brain sees that as smiley faces up to the last 3

lmao
today is really rough for me
i think i have some semblance of a solution in my mind for 2d
but to extend that to 3d...
How's everyone getting one with part 2 today? ||I have spent 20% of my time on a solution and 80% of my time squashing bugs, and I still got bugs||
||May need a step by step result for the last example saying how many cubes should be on at each step||
finally gave in and got a big tip and now I solved it with no statisfaction
I was very close the entire time
:(
had to look at someone else's solution to understand the problem, and once i did i attempted to reimplement it
not proud of myself at all
Yea basically same
Though I did have almost all of that myself at least
Only was needing that last push
how frustrating
yeah same
i had the general idea but it was lacking the example that brought it all together
so that wasnt fun :/
#advent-of-code-spoilers-archive message (in spoiler channel)
haha
nice
Cheers - that will be my last ditch attempt to get this working
because my code works on the earlier examples ๐ฆ
if thats the case ||you might fare better with a completely different algorithm for part 2||
This was harder than D19 if I'm being honest
||I did write a completely different algorithm for part 2 XD ||
And I found D19 hard
In the end the idea is quite simple
which one was 19?
but coming up with it
i forgot
beacons
I don't know why a weekday problem near Christmas is so hard ;(, hopefully tomorrow's a freebie
19 was ugly and full of debugging, but conceptually I had less trouble than today's
I struggle with anything 3D coordinate related
This is neat! Python is almost the majority https://jeroenheijmans.github.io/advent-of-code-surveys/
Results dashboard with the yearly (unofficial) Advent of Code participant survey
I just have trouble visualising the finer details of everything
whos writing stuff on wsl lmao
Yeah same
is a cube overlapping with another cube, is it not
I almost need cubes in my hand to play with to understand it
+1, for 2 minutes i truly considered if the data was given as points or cube locations
My code diverges somewhere in the middle of this, FML
rip
if its any consolation, i believe in you
Good thing I have a lot of rubic cubes
you've gotten so far and you're almost at the end
worst part is I'm not sure what I can even do once I get to the part where my code breaks D: the data will be vast enough that noticing anything weird may be very difficult
literally past halfway of that example and my code is perfect - D:
found the breaking point though
Someone suggested trying to reduce it to as little things as possible that still break it
but yeah sounds like it'd be quite hard
How do you kow it still breaks it 
Weird stuff today
I found the point where the test started to fail
my code fails at the second one lmao
but yeah, today is really a pain. A step by step for the big one would have been very useful
that's what i do
today is the first day where i really don't know what to do lmao
gonna reattempt tomorrow
you and me both ๐
after my code broke in the middle of the large example, I gave up on it
github copilot is cheating right
cheating? on what?
aoc
like
# given a list of integers, count the number of times the integers increase
boom function
done
well, there aren't rules against it, but it might ruin the fun
true
tbh if you can break it down to a command github copilot understands, you probably could do it without it anyway, but I can see where your point comes from
still, you would you count searching that exact same query for StackOverflow answers as cheating?
(well... maybe not the same query, but a similar one structured as a question instead of imperatively)
true
||# give the solution to the 2021 advent of code day 1 puzzle||
140 votes and 39 comments so far on Reddit
python miles ahead of others
rust ahead of js
i would have thought python and js would be the top two
lol what, Vim is the second most popular IDE?
of aoc? not surprised
by the way, it seems like the intersection between "using Rust" and "learning a new language" is high
>>> df.apply(lambda row: 'Rust' in row.Languages, axis = 1).sum()
504
>>> df.apply(lambda row: any('new lang' in reason for reason in row.Reason_for_participating), axis = 1).sum()
1046
>>> df.apply(lambda row: ('Rust' in row.Languages) and (any('new lang' in reason for reason in row.Reason_for_participating)), axis = 1).sum()
277
``` ~~not proud of this code but it works~~
using data from <https://raw.githubusercontent.com/jeroenheijmans/advent-of-code-surveys/master/2021/results-sanitzed.json>
oh, I forgot to mention: these are out of 4245
Take special care about the fact that there's heavy bias in the cohort surveyed. Most people came to the survey from either Reddit or Twitter, and this will skew the data accordingly. The more we can spread the word to a more representative AoC-user-base in the future years, the more interesting and correct the data becomes. But for now, remember that the results are about people that tend to see the survey around, not about "all AoC participants".
yeah, having it on the 20th day+ also skews it towards users that are still actively participating
so almost definitely many fewer first timers than if you asked on the first week
Why, what have you been using?
And why isn't it vim?
Neovim <3
we're getting to the bottom of the abyss. Who wants to speculate emptily on what the next task's lore will be? ๐ฅด
...why are we going to the bottom again?
oh, right
Apparently, one of the Elves tripped and accidentally sent the sleigh keys flying into the ocean!
it's always the elves' fault.
Santa better make an example of that elf
He cost us 25 days right at the busiest time of the year for Santa
next year, this elf will replace the sleigh as a meat toboggan
<@&518565788744024082> Good morning! Day 23 is ready to be attempted. View it online now at https://adventofcode.com/2021/day/23. Good luck!
oops
kaiju
you do?
today's one is probably the easyest to do without programming
um
yeah this
normally with stuff like this the input is bigger than this
the board game one a day or two ago is probably just as easy for part one if you dont code
it indeed is a pathfinding one
but i need an algo to decide which one to move when lol
lmao the puzzle input
dam
Shall use infinite monkey theorm
OMG
.
lmfao
i just gave it a try
p2 seems a brainfuck
2 people
on global
now 5
Hi
im satisfied with silver starring today within an hour
tomorrow ill go for gold
||can part 2 be done without any code whatsoever? idk how ill exactly show my solution on my repo but ill figure that out when i get there||
lmfao
just write
||import brain||
in repo
ImportError
||im gonna try at least||
hm part 2
seems infinitely easier than ||having to figure out how to do this with an algorithm then implementing said algorithm||
Did anyone else get an error while submitting an answer, but it accepted it anyways?
Like I got a "wait 5 seconds" (even though i didnt submit a wrong answer) and it still worked
46/50 stars!
Would this be a good use case for || heuristics and NFA's ||?
uhhhhhhhhh
what da HECK
I feel like solving by hand lmao
what is part two though
part 2 is ||twice as big rooms with twice as many amphipods to start with||
aaaaaa
wait until tomorrow to compare completion rates, some people dont do it soon as it comes out because they are in an inconvenient timezone and need to sleep or do something
I'm still taking my breakfast
today is kind of interesting. I don't have a ton of time, but lets see how far I can get.
pain
my queues are getting to half a million items, so things could be worse
Debugging thgis is actually impossible
how come my brute force whatever garbage can't even get all possibilites right
I don't know
have been debugging for like 2h and Is till don't know
rofl.
I'm considering just doing it manually
would be easier.
Am I even on the right path using ||A*||?
||that's one way of doing it||
i went with ||dijkstras but theres so many low total cost states like aaa||
||is there some smart heuristic? Currently I just have minimum (manhattan) distance to a "resting spot" * cost per move for every block||
||my a* impl slowed things down compared to dijkstra's, may be a bug though. what you're saying sounds fine. I'd look into increasing it/s if I were you||
||I'm already at 17 minutes at 10k it/s, should I be trying for even more?||
||actually your state space is probably bigger than expected, I only go through 150k its total||
||i donโt think it should take 17 mins lol||
||me neither ๐ข ||
||yeah, from what iโve heard, A* is slower than dijkstraโs in this case||
||wow, so many spoilers||
||using manhattan distance as the heuristic that is||
I wonder if my error is acuse I use generators
generators how so
It's literally just brute force
except it doesn't work
at all
not evne on part 1
No idea what else you'd do my brain isn't getting it
Here's my code maybe you can see my error ||https://paste.pythondiscord.com/wovaduyivu.sql||
But yeah no idea.
It's not even a good solution based on all other days this will never work for aprt 2
Impossible to debug tho.
Might have to scrap it and think of something else I supopse.
||I used the "real" distance and now it's working at least for the sample input, still kinda slow tho (40s)||
nice!
today destroyed me for some reason
good luck
I mean
took me ~4 hours and > twice the code I've written for any other day
technciaklly it should work for part 2
||are you using an algorithm for it ||
it should prob take like 2 hours to run though
Grab
starts with b 2nd word f
||bfs?||
break fast?
yes breakfast
no ||brute force||
i have no idea how you can use anything else
tbh
so i'm just kinda hoping it'll work
:)
.
you could use ||A*||
how much faster is that compared to the naive one?
i dont know i havent implemented either way yet, did both parts in my mind, now need to code them up after having slept and showered my mind is clear lol
Yep i'm screwed
:)
cannot actually complete anything
i guess I need to change how its done
nice!
Real input still not working tho, killed it after ~10 minutes
Ugh, I guess I'll take a shower and see if it gave the answer after I come back ๐คทโโ๏ธ
Okay I'm at a loss
Ran for over half an hour, 6M+ iterations, still no solution
Any ideas?
||it is not intended to be done by code ||
this isn't all that bad
its actually pretty fun
yeah, I agree
||and imo a whole hell of a lot easier than previous days||
||im probably gonna do it by hand first, like in day 8||
doing that for part 2 as well
that would be funny but im not sure
how do you know how it's "intended" to be done?
||not necessarily to be done by code , if you want to save time||
||or bruteforce path finding is the only sol i see with code anyway :P||
can someone explain to me how the d21 quantum dice actually work please? I'm a little confused as to when the deterministic numbers increment
||Quantum dice splits the world into 3 possibilities everytime you roll it||
so it only ever has the values 1, 2 or 3?
yes
Yeah, just got two stars after nothing in a few days. I'm so happy right now
.......
akarys@mojito ~/P/aoc-2021 (main)> python day_23/part_1.py
fish: Job 1, 'python day_23/part_1.py' terminated by signal SIGSEGV (Address boundary error)
I broke CPython
did you set a higher recusion limit?
yeah
well yeah that would do it
!e
import sys
sys.setrecursionlimit(10 ** 7)```
@hollow wharf :warning: Your eval job has completed with return code 0.
[No output]
if you missed a base case or constraints aren't valid and you get a loop you'll get that, to be expected
aaa
hello guys is it ok if I permanently disable the 'Workspace Trust'
as it is not allowiing me to debug my code
Is that really even necessary? Haven't even gotten close to the limit in all my solutions
Nice!
dang im only on day 10 still
Hi, Iโm just starting to learn python. Which channel can I get help from or see how can I learn python?
!e
for i in range(5):
print((i+1) * "*")
@ivory horizon :white_check_mark: Your eval job has completed with return code 0.
001 | *
002 | **
003 | ***
004 | ****
005 | *****
Lol nice
First, I'd look at available guides. Here is a starting point: https://www.pythondiscord.com/resources/
If you have specific questions: #โ๏ฝhow-to-get-help
!e for i in range(3):
for j in range(i, i + 3):
print(""(j+1))
@glad tartan :white_check_mark: Your eval job has completed with return code 0.
001 | *
002 | **
003 | ***
004 | **
005 | ***
006 | ****
007 | ***
008 | ****
009 | *****
Just stumbled across this channel. I'm currently working on day 22. Not hard to guess what part 2 will introduce, so I'm not brute-forcing it.
i knew what would happen and I fully brute forced it anyway
๐ข
!e for i in range(3):
for j in range(i, i + 3):
print("{:^30}".format(""(2*j+1)))
@glad tartan :white_check_mark: Your eval job has completed with return code 0.
001 | *
002 | ***
003 | *****
004 | ***
005 | *****
006 | *******
007 | *****
008 | *******
009 | *********
I'm kind of tempted to. It's becoming way more annoying to implement than I expected.
!e
i=8,9
o=range(10)
l=''.join(' X'[c in i]for c in o)
for r in o:
print(l)
l=''.join('X '[l[c-1:c+2]in('XXX',' ','X ','',' ')]for c in o)
@muted aurora :white_check_mark: Your eval job has completed with return code 0.
001 | XX
002 | XXX
003 | XX X
004 | XXXXX
005 | XX X
006 | XXX XX
007 | XX X XXX
008 | XXXXXXX X
009 | X XXX
010 | X XX X
My main language is R, since I'm a data science student, but Python is a better choice for most Advent of Code puzzles, I think.
I think so too, but then again the best tool is the one you already have ๐
that's the spirit

Indeed, though I'm almost as comfortable with Python now. I actually learned it in last year's Advent of Code.
how do you get this?
bunch of charts
Likle who was the first 2nd and third tfor a problem on private leaderboard
part 1/2
some other stats for it
actual cahrt
This is my python private leaderboard chart
I actually just joined the leaderboard because I see myself as a pythonista but right after I did I remembered I was using lisp lol. I wonder how many people on the Python leaderboard didn't actually use python, probably not that many lol
A lot of people actually
Lisp is cool
Seen people use Rust, Haskell (ahem Aurora I think), SED for one of them, Gurklang for a few of them and more
Yeah everyone that doesn't use python is bad
:)
I mostly used js
lol
I did some haskell
I tried anyway
Haha awesome
last few days have changed to mostly python tho
- an image + actual input files since I got lazy
I thought maybe the first 2000 lines of code being the input is a bit annoying after all

Do some of these solutions of yours use both js and python? Like day 6 and 10?
yes
Well they aren't the same solution
Ah
it's two attempts of different stuff
like that day 16 is my "regex only part 1 solve"
Which I am still pretty proud about
was fun
the js is the normal solution
Lol that's sick
I liked it
Not even that hard if you think about what that part 1 is but yea was fun
I always thought part of the fun challenge of these problems was refactoring between parts and extending your functions, do you get to do that when you switch languages between parts much?
Hmm not suree
I guess you can use most of the same code though so it may be similar
mate solved d16 with regex- how
how do you wield this unholy power
Only part1
How many gold stars do yall have in advent of code
i'm lagging behind since day 19, these puzzles are slowly exceeding my capabilities
scratch that, rapidly exceeding
well, except for day 20, that was a breather
That's when the real fun begins, no? ๐ค
agreed, the fun of tearing your hair out for hours trying to find a semblance of an approach to the problem
I just call it "growth". But I suppose you could detail the specifics of the mania ๐
Me too. I haven't attempted several of the harder ones yet.
Imagine, having hair. ๐
lmao yeah
well i've heard that d19 isn't really hard, just complex and tedious to implement
but d22 is torture
cuboid overlapping, so fun
It seemed simple enough going in; just ||build a class to represent intervals for each dimension and update it to add or subtract intervals||. But that is proving a lot tougher than I expected.
protip ||negative volume cancels the intersection||
There are two main ways to solve it
One is more thinking and slower and one is pretty obvious but kinda hard
That's what I'd say
!e
def cristmas_tree(n):
z = n - 1
x = 1
for i in range(n):
print(' ' * z + '+' * x + ' ' * z)
x+=2
z-=1
print(''*n/2+'|||')
cristmas_tree(9)
@stark gulch :x: Your eval job has completed with return code 1.
001 | +
002 | +++
003 | +++++
004 | +++++++
005 | +++++++++
006 | +++++++++++
007 | +++++++++++++
008 | +++++++++++++++
009 | +++++++++++++++++
010 | Traceback (most recent call last):
011 | File "<string>", line 9, in <module>
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/eqodozutix.txt?noredirect
!e
def cristmas_tree(n):
z = n - 1
x = 1
for i in range(n):
print(' ' * z + '+' * x + ' ' * z)
x+=2
z-=1
print(''*n/2+'|||')
cristmas_tree(3)
@stark gulch :x: Your eval job has completed with return code 1.
001 | +
002 | +++
003 | +++++
004 | Traceback (most recent call last):
005 | File "<string>", line 9, in <module>
006 | File "<string>", line 8, in cristmas_tree
007 | TypeError: unsupported operand type(s) for /: 'str' and 'int'
#bot-commands ?
#26! Was very exciting!
best rank for me was 327, day 3
d21p1: lol easy problem, just some die state tracking and... we're done! first try!
d21p2: ||now trifurcate the entire fking universe exponentially using a quantum die. perform doctor strange operations. in how many universes does the winner win?||
my best has been 209 so far
you might wanna spoiler this though btw I think
at least P2
done
||t r i f u r c a t e||
refined
Just realized my approach to day 22 fundamentally won't work. That's no fun.
||As you experiment with the die, you feel a little strange.||
please tell me that as i hover over this text a doctor strange easter egg pops up
today
currently d22p2 is breaking my brain completely
i'm surprised i still haven't given up considering the zero progress lmao
me2 ๐
day 19 and day 23
I had a delightful time with day 15. I looked up pseudocode for ||Dijkstra's algorithm|| and kludged it together.
mistyping self, this is a sign from the aoc gods...
since when does round not round to the next hightest number, if its .5 ?
!e
print(round(6.5))
@restive imp :white_check_mark: Your eval job has completed with return code 0.
6
it rounds to the nearest even number if there's a tie
does anyone have another step by step solution of a test case?
the example works well while my input doesn't...
Relatable
Seriously can anyone help me
someone posted a video solution for an example in the spoilers channel
look in the chat history
ohh, wow. that is a weird implementation. never realized that
Okay, thanks
I already found one bug so far thanks to it
.aoc join
This implementation is useful as it makes the sums of a bunch of rounded values closer to the truth
If everything at .5 rounded up you would get worse and worse estimates as you sum numbers
But since on average half the .5s round up and half round down, the net effect is offset
Banks use this a lot, or alternatively swapping between going up and down as they round
I see, that is a good reason. I take the 'weird' back then xD
It's obviously too late to start now, right?
My computed answer for day 21's test case is off by three or four orders of magnitude. Time to do something else for a while, I think.
that's entirely up to you ๐
Not at all! Once posted, the puzzles are up forever.
.aoc link jmcantrell
You have linked your Discord ID to jmcantrell.
D25P2 is free, right?
omg hahastinkydog is back
||i think so||
||it always has been in the past||
inb4 this time it changes
d25p1 is free and d25p2 is the hardest challenge ever
after 24 hours only 20 of the top spots are claimed

i've never realized that - so cool
i always thought the solution to this problem was just to sum them up before rounding
d25p2 expectations:
you've finally found santa's sleigh key! great job! type the word "pick" to pick it up, then you'll be done!
d25p2 reality:
the key is stranded between two parallel universes. to pick up the key, you need to solve riemann's hypothesis and use the result to crack a AES-256 cipher by brute force with a quantum computer. then, find a 5th dimension solution allowing the halting problem to be decidable. a transcendent diety shall then descend to the mortal plane, blessing you with 6 divine characters of the Shadow Realm. these divine characters, combined with a sacrifice of fresh human blood, will grant you the final 8 digits solving the puzzle. what are the 8 digits?
Answer: __________________ [Submit]
say hello to my first python script
collatz?
Looks like it
though this is #advent-of-code
a = a//2 would make a always stay an integer btw, just for prettiness purposes
press the autoformat hotkey ๐
post-completion write up
.aoc countdown
Day 24 starts <t:1640322000:R>.
Tomorrow better be easy
Hey, who's ready for AoC today?
Not me ๐ I'm behind
I finished D22 but I'm working on D23 as we speak
I think I'm gonna get some rest and work on it with a ready brain tbh
Hopefully it's a nicer one today ๐ค




