#advent-of-code
1 messages ยท Page 52 of 1
I didn't actually intend to stay up for this, but here I am ๐
(its still today for me bc it unlocks 9 pm)
I think Eric should be aware though that tomorrow is Christmas Eve and so hopefully it's easy
ive heard he makes it easy for christmas day
i hope that also applies to christmas eve
watching the aoc conference that eric did in 2019
the crowd is just dead silent the whole time
(not literally, but still)
~30 seconds left
.aoc c
Day 24 starts <t:1640322000:R>.
10 seconds left!
<@&518565788744024082> Good morning! Day 24 is ready to be attempted. View it online now at https://adventofcode.com/2021/day/24. Good luck!
oops
NICE
do you live in this channel;
sixth
seems fun
I feel like once again, my lack of understanding of the question in the first place might be my downfall here
I should probably turn my screenreader on but I'm not sure it'll like all of the numbers etc.
wow 8 mins
i don't even understand how I will even approach today's question ๐
seems like no one understood the ques lol
p2 is defo going to have jumps
inp is the number
no, value is non zero
||pretty sure it wont, the input doesnt change between parts||
The ALU is a four-dimensional processing unit: it has integer variables w, x, y, and z. These variables all start with the value 0
someone finished both parts already, damn
just like yesterdays...they may tell to add some small shit to input
anyone else use ||match|| & ||case|| forthis?
||nopeeee 3.7.3 all the way ||
||im in 3.10 but i dont wanna use match case||
actually this is a lie ||i use 3.8 now bc it's 64 bit ||
extra tempted to ||just use a dict to store the values of everything||
perhaps ||the forbidden eval()|| will make a reappearance today?
I have a working code but I have done some calculations and it will take roughly 3.17 years for it to run fully
well this is.... ||a bit large....||
for this, can we assume that ||all values below the maximum are valid and all above are invalid|| or ||are the valid values scattered throughout the possible values||?
you did it by hand?!?
||9^14, 9 possible values per character, 14 characters required||
So the crux of this is to look at the || instructions that follow each input and figure out the valid input range for that digit|| right?
||are the valid values scattered or are they constant up to a certain point||
i have no clue
Could a runtime for the solution be || 14 * 9 aka O(n) in the number of digits of the model number ||
keep in mind ||x y and z stay the same after inputs||
Sure, so you have to || manage that carryover as well ||
so ||for setting x to x + input you'd have to also take into account what x was before an input||
i was thinking ||find z as an expression of inputs a-n||
then ||pray that eric made the valid numbers constant and not scattered ||
i'll do this tomorrow, but im really glad it's this easy
I literally just wasted a minute by typoing 14 to 24 -_-
Yes, you should really be ||decompiling your input||
.aoc unsubscribe
Okay! You have been unsubscribed from notifications about new Advent of Code tasks.
.aoc unsubscribe
Okay! You have been unsubscribed from notifications about new Advent of Code tasks.
For day 20, part 1, I get the same output for the example after the two image enhancements, but an incorrect result on the real input. Some of my assumptions are that the image expands by 1 pixel on every side with each enhancement and that every new pixel value is determined before any existing pixels are altered. Is this right?
I think your assumption is somewhat right. This is what helped me: #advent-of-code message
For AoC day 5, I'm handling those coordinates by checking if either side are equal and if so, taking the other side and using them as a range to append to a Counter, basically doing for i in range(y.1, y.2+1) when x is equal
However, when I hit the line 2,2 -> 2,1 from the test data, I'm basically doing for i in range(2, 1+1), which is clearly an issue, so I'm trying to work out a better way to handle this. Has anyone got any ideas? (The screenshot shows the portion of code I'm looking at)
You can just swap the two if they are in the wrong order.
e.g. a,b = min(a,b), max(a,b)
That sounds like it'll work. I never think of those
Haven't looked at today's thing yet, how is it in terms of difficulty?
Compared to the last few
naive solution is trivial, its just an optimisation problem
Hmm
Still not sure how to optimize it
seemed easy but maybe it's not that easy?
Maybe i'm jst dumb and doing useless stuff
Lol
... there is no example for today, is there
There are a few
just no working value
Hmm
Honestly copnsidering just doing it on paper
seems easier than trying to find an algorithm at this point
Hard. ๐
I think I underestimated the time needed to bruteforce
I don't want to do constraint solving
||imo the main idea for optimising is the fact that whatever an input digit is, its not equal to a variable if its 10+, which leads to a lot of cases where a digit is free to be whatever||
I feel like I saw that but I am still not sure how to actually use that information to do anything
I guess one more thing to reduce
and thats why im going line by line with pen and paper ๐
yea almost feel like that's easier
than doing it with an algorithm
just get a z = at the end or smth
||trust me there's a TON of useless operations||
||im 45 lines in and there has been a net of 1 useful operation||
||all the other 'useful' ops are literally part of something that resolves to 1 for whatever input digit so no need to even calculate em each time||
I wanted to make somethign that goes through and figures this out but it didn't work out so well
maybe its no-code time
Oh wait big brain idea
||We could instead go through sections at a time, say between y=0 resets, and run through the possible digit inputs, link them to the output variables. If the output dict is constant then we know the value of the digit doesn't matter so we lock that in at 9 and move on||
||Would still have to manually go through the actually meaningful digits if we want more optimisation but still||
|| oh duh the splits we wanna use are just the input lines, so that even if the w variable changes then we ignore it anyway as it's about to be overwritten||
I kinda tried something ismilar to this but I think it doesn't quite work
Maybe I was just doing it dumb though
I think I tried something different with those that makes less sense
tbh
||I'm sure there are still exceptions and you'd have to take a look at them, in fact there necessarily must be orher wise 999999...999 would be valid||
But cute down a lot of the work
It's possible it may cut down the work yea
||Even a single deduction divides the search space by 10 so whilst we may not get them all we still have a good shot, and can perhaps manually finish it or run exhaustive search||
I've started loving asserts tho
more asserts more better
I've also noticed that || each of the sectors has barely any difference, 1-3 commands wonder if that is useful to know||
case _:
assert False, 'AAAAAA'
``` in my match-case tree, just for you
Yea
Still trying to figure out how to limit anything
except no-code
which sounds easier at this point
Though I should be able to do what I do with no code in code as well right

||if you cut the code into blocks you can abuse the repetition of patterns in there to reduce the computation required for each step||
did you successfully brute force it after that change ?
not yet but i can see how itll work, as there's ||a lot of cancellation, for example only the prev. value of z is relevant in each block||
yes I saw that
Yea
I'm thinking if you can solve each block based on requirements
That should technically work sounds pretty hard tho
||could go backwards block by block too ig once you know the relations||
||Like if you do the math you can find out that the last block either requires z to be 0 or z%26 to be equal to w, you could solve the other blocks trying to get either of that||
exactly
yup
||looks like it probably wont ever be 0, so you can probably get away with using mod26 throughout||
Persumably
I just got an idea
reading a reddit post
||"The number of possible states the ALU can reach at a given line is significantly smaller than the possible number of input read "||
so maybe
Idk ||I tried going that route and the first sector literally just sets z to w+7||
||Which would make the states = to the inputs||
Maybe it gets betters
||we can build a dictionary with key (z,w,current_digit_index) and value true if final z is 0 and false if it's not||
so that we don't calculate 2 times the same thing
basically what I wanted to do but it seems to still have a ton of possibilities so yeah idk
hey guys my input code is correct but vs code is not lettin' me enter the input how to resolve this error
a = input("Enter your age\n")
if(a>=18):
print("Yes,your age is greater than 18")
else:
print("No,your age is less than 18")
someone pls help me out
rofl if this pattern repeats the entire time I am pretty sure i know what to do to calculate it faster
no-code op ig
Yeah I have no idea what I'm doing today 
Stare at it for a long time and then continue being confused
smth like that
Feels not that hard though
if you ever get the idea what you are doing care to explain
onyl person it hurts is people trying to steal your code ๐
all of the puzzles starting from d18 are just on another plane of existence lmao (except for d20)

Scientist only know 3 planes of existences so far
normal plane
banana smoothie plane
aoc day18+ plane
We are still trying to get into the smoothie plane
I thought day 19 was supposed to be the peak 
Apparently not
Though it honestly does not feel that hard today
you can technically solve it trivially not sure if it'd finish today tho

depends what youre better at, certain problems can be harder for certain people
same. then came d21p2, then d22, then d23...
lmao, you can solve d14 trivially, simply wait for a few thousand years, no big deal
Unless you have a lot of RAM/Space tho..
also you can't really parallize that well
today would be trivial
Lol
tomorrow should be ok
Could easily split it into 100 servers and search all of them
Hm?
forget it
pure bruh moment
rip
I got something else now
a magic formula
|| for any step: z=z//v1*(25*(z%26+v2 != w)+1)+(w+v3)*(z%26+v2 != w)||
I believe.
itering throught all possibilities is too long even if you just loop without doing anything
Hmm
it'll be too long
I think we're not supposed to code x)
You can definitely do it with code
but yeah it kinda feels like it'd be easier without at this point
Lol
Nice
haha
Beep boop
I'm the computer now

PRob gonna fail horrilby after like 2 or 3 though
So day 24 can't reasonably be brute-forced? Scanning the input, I couldn't see any obvious optimizations beyond ||ignoring instructions to divide or multiply by 1||.
We managed to get it down to like a single formula for the value we care about + a few random digits
but even then taht's too much
Even calculating one formula a few quadrillion times would take forever
by extension, ||if any operation multiplies by zero, just immediately set it to zero||
Yeah there are a few things you can do to reduce it
or if any ||adds by zero, skip||
ah yes it'll be done soon
My ||poorly implemented Dikjstra|| for day 15 took 10 or 15 minutes, which was the longest one for me so far.
I left my day23 part 2 run over night (||A* with quite a few optimisations||)
Guess what
no result
f
๐คทโโ๏ธ
I heard on the subreddit that ||some inputs are a lot easier to solve than others, to the point that one poster had one that was easy to hand-solve||.
@proud cosmos could I try your input?
Just wondering
||#############
#...........#
###A#C#B#D###
#B#A#D#C#
#########||
rip formating

But yeah my part2 is incredibly fast with that input
It's like 10x fater than part1

Oh ||I took a closer look at my input and the sequence of operations is periodic, so I think I can take a crack at this||.
Also ||some of the constants in the input seem to be hinting at something...||
HUh?
You probably have hanging code somewhere
Oh
It should finish relatively quickly tho it prob goes through some invalid states or smth?
Did you see if the example works with the numbers
Maybe assert every step of the example
More asserts more better
Well my hand method worked for about 1/4 of the input
now it;s just too big
:)
||the 26 is sadly a red herring if thats what you're referring to:(||
Not looking at this spoiler just yet. I think I'm on the right track ๐ค
||just if the constant 26 reminds you of the alphabet, its arbitrary and sadly you dont get any nice word outputs||
that should be spoilered
hmm
I feel quite lost now
maybe I should just let a brute force attempt run anyway
Lol.
||the final solution is gonna be brute force at least for me, but you can massively reduce the search space||
||when you reduce the search to 7 digits only you can still do it at a decent speed especially when you know how the blocks work and make that process faster||
Okay I efel like I kinda get what to do now
but I still don't really get how to do it

i dont
i tried creating a magic equation for z
that i could ||run through eval||
turns out that its too long
and causes a stack overflow
rip
so i dont know what to do at this point
go ||through the stuff and find a pattern||
It does seem ||the sequence of instructions is the same for each block, with only the values differing. So you could maybe write a function with the instructions and partialize it with the values for each block||.
Or, ||you could use backtracking if you wanted to.||
I feel like I know what my very last number should be
rofl
so that's cool (?)
I think anyway
Like i'm quite certain that it must be that number or else it wouldn't work
I could backtrack no-code from here ig

so for me ||the values on lines 5, 6 and 16 for each segment of inputs differs||
for me ||[5, 6, 16]||
wait yeah thats it for me
you should have three lines that changes
Okay I can pretty much guarantee that || z <= 5109711748 for all steps||
I can prob press that upper boudn down
might be useful

how do you get that
||I made a magic formula and checkd what the "impossible best case" would be roughly||
should be way too high though and not acutally doable
Weird wonder why

I mean that's normal though
Any chance I could have some help with part 2 of day 5? I'm finding that this is passing the tests, but when I run it with my actual input, it's lagging out/hanging. I think the issue is with lines 31-36 here (or the whole of the while loop at line 28) but I'm not sure how to go about changing/making it work properly. Any suggestions/advice would be greatly appreciated. https://paste.pythondiscord.com/ulofonanac.apache
Really? I've had whole discussions about previous days here before
Im gonna guess that people are busy those two days usually.
Also where do I go if I don't want spoilers for today?
that... defeats the purpose of a spoiler channel
I feel like it should be fine here, maybe spoiler the link
Though I am not sure how much help you will get most people sit in spoilers when they are done
Tbf yesterday was quite hard
I'm asking for help on something from 3 weeks ago without seeing the stuff that's happened sinc ethen?
we have to complete day 25
otherwise christmas won't be happening
one person* needs to complete day 25?

yes

I believe day 25 is traditionally easy, because not many people want a hard puzzle on Christmas day, but you never know. Last year it was very easy.
what's advent of code
Advent of Code is an event every year where you get a challenge a day from the 1st of December to the 25th
also you have the exact same pfp as @hidden musk lmao
although the character is not mine
i was scrolling to discord and i saw ur pfp so i copied it, my bad for not asking permission, is it fine tho if i use it
ยฏ_(ใ)_/ยฏ, kinda weird though
hayan from unholy blood
was a great read, I went on hiatus for a while so im not all caught up
Ngl yesterday was pretty hard
A lot of people did it by hand
yeah, i looked over it
seems.. interesting
kinda reminds me of the towers of hanoi problem
Yeah exactly, someone visualized it and it looked a lot like the Tower of Hanoi problem
Happy hollidays!
Only 12h 30m left until the last set of problems are released
12h 30m left until we find out what happened to the keys
nvm you've left them at home unlucky
On each iteration of while tuple(marker) != end_point: print out tuple(marker) and end_point - you'll see what's going wrong
out of curiosity ||i tried to find the entire equation for z given a whole number. i cant even read the whole thing||
||the whole file is just text with the equation||
|| you can simplyfy that greatly ||
yeah i did
but i just wanted to see ||the whole unsimplified equation in all its glory||
I've got to a point where I'm getting a final answer that's wrong. I think it's something to do with the way I'm adding to my ||counter||, but IDK?
||throw it into desmos :)||
ez solve
||its a 14 variable equation||
||maybe symbolab or wra||
||only one variable if you use 14 digit x values on graph||
||wait can desmos do substrings||
||no need, just use modulo to separate the digits||
ok theres just one problem with that
||i cant copy the whole equation because its so big||
||the other problem being that theres no way desmos will ever be able to rnder that||
taking a break from aoc today ๐ gonna finally start learning numpy
i'm already in love
i regret never touching this for the entire calendar
used it for only the cubes i think
R is my first love, but NumPy is fast and powerful.
the more i read from the documentation, the further i fall in love with numpy
and i'm not even done reading the introduction yet lmfao ๐คฃ
same
i'm going to re-do some early aoc puzzles using numpy when i learn it
wait
question
we've been in a submarine for almost 25 days
in terms of food
...what happened to all those fish we met along the way?
||joke dont get mad at me ik its a stupid question||
no grand mission is without sacrifice. collateral damage was inevitable; santa's cause is considerably more significant then a couple trillion lives of unimportant lanternfish. we did spare the snailfish, though, for fear of retaliation... they aren't the best species to mess with.
They multiply too fast anyway
Merry Christmas everyone!
Still at 28 stars haha
I wanted to give a shot to the other days but Iโll think Iโll take a break for now
A short one though
I tried to use both when I could
ggs!
Gg
i was watching the advent of code conference and eric said that a college used 2016d6 as the midterm for a computing course
then d18+ is hell
wow...
I stop at day 10 usually
Also I noticed the personal ranking lol
Got no points because I took 18 hours to several days lol
This is what happens when Iโm distracted
lol yeah i just tried it, just one-lined it in the REPL
youd be surprised by how easy college finals can be when it comes to puzzle-likes...
wait until you hear about Arraymancer
santa uses minecart?
yes, no sledge in minecraft
watch eric make day 25 the hardest day on the whole calendar because he thinks it would be funny
lmao i too think he has that power
he can ruin the day
๐
yes if the keys are lost then christmas is ruined
given this list of 500 coordinates, find the real cities these coordinates map to, and give the lowest possible cost to travel city to city, assuming each day a different city is visited and, and each night you must stay at a hotel in the city you just entered.
that sounds like christmas
part 2: Assuming you have COVID at the start of your trip, how many people will have it at the end, given the populations of each of those cities and the sizes of their airports, and assuming the Omicron variant of SARS-CoV-2 infects one out of every thousand people exposed to it each day.
part 3: find the bomb I've hidden in your house, what is it's serial number
part 3: given the publicly available covid data, determine the number of variants that exist, and multiply that by the highest r-naught among all variants
reverse-engineer the bomb's cryptographic handshake and determine the disarm code. You have 3 tries before the bomb explodes as an anti-tamper mechanism.
Happy Christmas at least in asia ๐
what are you guys doing after AOC ? Leetcode?
AOC was really fun though learnt graph traversal, dijkstra and lots of code golfing XD
<@&518565788744024082> Good morning! Day 25 is ready to be attempted. View it online now at https://adventofcode.com/2021/day/25. Good luck!
merry christmas east coast!
ยกfeliz navidad!
Due to strong water currents in the area, sea cucumbers that move off the right edge of the map appear on the left edge, and sea cucumbers that move off the bottom edge of the map appear on the top edge.
input the answer into the keypad to disarm the bomb, you have 30 minutes
lol are d25 part 2s always like this
yes
gg everyone, gl next year ๐
||im simulating right, but its not stopping after the expected amount of steps||...
Make sure you ||remember to wrap around the edges||
i am
i checked the sample
the individual steps look fine
but its not detecting when none move
If you're ||comparing lists||, consider ||just counting the moves you make manually|| instead
Personally I ||wrote a function which does the move, and counts how many things it moved|| which is probably a similar idea to what everyone else did
Merry Christmas!
Merry Halloween Christmas!
lolol
nevermind i was checking the wrong input
ooops
so im assuming as the time between moving everything reduces, the grid gets closer and closer to solving?
still waiting for 3DS
But those aren't any of the 5 platonic solids, they'd have to be awkward shapes
hm?
D4, D6, D8, D12, D20
Tbf people have made a D3, which is basically just a triangular prism
(and a D2, otherwise known as a coin)
similar to Day 22
or was it Day 21
the Dirac Dice
:D
woah
thats cool
What does this look like
what is it
trench
Is there a non brute force solution to 25
it's fine to do it the naive way - remember that (this is a minor spoiler for day25 part2 of every AoC year) ||there's no part2, so the part1 is all there is||
why will you call it brute force in the first place
๐ ||its just quadratic solution||
Wow, this is beautiful 
pretty lights
omg the size of the input
spoiler!
||it made me question myself if my 2d lists simulation will finish on time but yes it does ||
Show off ๐
let's gooooooooooo
you can always reattempt it again in your life โข๏ธ
ooooh I know what the calendar is now
it is very hard haha
Happy life
Wouldn't call it easy yeah
for some days I invested my entire day essentially
but it feels so good
Please tell me today's was not another head scratcher
I just want my 50 stars but I'm done thinking
It was easy
I had some stupid issue I didn't get for a while but you can probably do it in like a few minutes
Yes
You got it I presume?
yeah, just went to make some breakfast first, petty soft
solution takes forever, but we did it boys:
20 seconds lol
5:49 :) cos i couldnt be bothered to make it efficient
couldn't be bothered to check if I would overwrite stuff, so just making multiple copies every time
Yeah, mine was instant too.
I am in spain but the s is silent
4 more puzzles to go for me !!
almost there!
reminds me of snow on christmas morning
I am seeing a pattern but couldn't quite describe it
or just really bad traffic
going to post a longer version, just compressing it
screen recordings on my computer are hugee
oh i should do this with carriage return
I'm just using an ANSI code to just to the top
no fancy library
while True:
print(chr(27) + "[2J")
# perform step
print_grid(cur)
os.sleep(0.1)
That's super fancy
ah shit haven't looked at reddit yet
Merry Christmas ๐ฒ
Merry hristmas
day 25, finally a not-so-hard puzzle :D
anyways merry Christmas guys!!!
what an event
absolutely amazing
(even though I basically couldn't do anything after day 18 except for day 20 lmao)
I might reattempt the harder puzzles when I have time... waiting for that one day when I'll finally get 50 stars lol
also @woven oriole congrats! our first cat dev completionist
Merry Christmas to all of you, 'twas a fun ride with some really great people. I'll see y'all around :) ๐
so long, and thanks for all the lanternfish
its kinda sad theres only 25 days of advent
Yeah ikr
lmao thanks , merry christmas ๐
started out with numpy ๐
i shall too lets go
day 26 : lanternfishes occupied mars because no space
I said previous weekend "I think we had the worst part, should be relatively smooth sailing from here on out"
Oh how young and naive I was
Well, they all move simultaneously so when the sea cucumber you circled in the first step tries to move and wrap around, it takes that state meaning that the other sea cucumber is blocking it so it doesn't move
it was intended to go there but there's already one v in its place which moves downward since its dot below it
thanks, now I get it
Np!
Data Analyst or Data Engineer ?
Data Lanternfish
(I'm joking, you're in the channel for advent of code, which is a yearly event around this time)
Maybe try #career-advice ?
numpy. is. amazing.
Nice!
all the times when i did sum(bruh < something for seq in 2dseq for bruh in seq), i could've just numpy'd lmao
To be fair that is not relaly that much worse in my opinion
but it is nice it works
it's not, but when the entire aoc is just 2d and 3d matrix puzzles (\s, but these puzzles are pretty common), it gets pretty bad
so many early days can be solved elegantly with a few lines of numpy
the later days, not so much, but the early days with numpy is :chefskiss:
YOU CAN EVEN SPECIFY AXES AND CUMULATIVE SUMS?!!
i'm in love halp
don't tell this guy about array programming languages :P
dont tell him about matlab or R or julia, or he goin crazy
For me nothing beats R's "most things are vectors or functions" approach. Simple, yet versatile and convenient to work with. But NumPy's not far behind.
ยฏ_(ใ)_/ยฏ
maybe one day i'll revisit R
i just touched that lang ever so slightly during my statistics class in my first year of college
It has always felt more natural than Python for data manipulation to me, although I'm biased in R's favor because I learned it first. It does have more quirks and questionable implementation decisions than Python, though.
that's saying a lot about R's implementation lmao
I don't think it has any truly awful features, but I would get rid of stuff like partial argument matching if I had the power. There are several elements like that that feel like relics of a time when R was mostly used interactively or for small analysis projects.
kinda confused, i just randomly decided to program the final day
i'm done programming it but I'm confused what the input is, it came from the previous day didnt it? does anyone have it?
wdym
day 25?
the input is the same as always
if you mean part 2 then ||you need to fully complete all other days in the calendar to finish part 2||
Until when do we have time to complete the 50 stars to get the AOC Finisher role?
Is that automatically applied?
It will be automatically applied and will run until February iirc
do i not get the role
january i believe
yeah if you get all 50 by january you get the aoc completionist role
so that gives you roughly 5-6 days
ah, well then i'm basically dead. it's been a good game, i'll see y'all next year :D
well thats just if you want the role
although i am learning numpy now and it's absolutely amazing
i know
i won't be able to get it, these puzzles just get way too hard for me (for now)
next year i'll see if i can beat this year's score
๐ I'm already at day 4
definitely will be able to finish the rest before january
Where can I learn NumPy from?
youtube tutorials might be useful
ty
famous last words
https://numpy.org/doc/stable/user/whatisnumpy.html starting from here and reading through the chain of docs is what i did, but if you're more of a video-learner you can find some tutorials on youtube
:D thank you
I've just given up XD
you're welcome!
same lol, trying today because it seems easier
day 19, 21, 22, 23, and 24 are just :sigh:
We did all the 50 stars without any external libs
That's very much doable without numpy
amazing
Me who doesn't know many useful external libraries:
ah yes, input49.py
imposter spotted
i
what a ride
welp, i may not have saved christmas, but i got 40 of them shiny stars lmao
double my initial goal
this has been such a fun event, i absolutely love aoc
will come back to the harder puzzles later to see if i can get 50 stars lol
@sleek cave ayy, at least you got your 40! nothing to scoff at
some of the later ones were very hard
i know, i'm extremely glad lol. aoc is probably one of the coolest and most fun programming events i've ever participated in, even though the harder puzzles really destroyed my brain lmao
taught me so much stuff
absolutely amazing
I got 36. More I think than last year. Not sure how much further I'll go, though I would like to finish off part 2 of day 21.
i got 8 B)
d21p1: bruh so ez
d22p2: now, become doctor strange.
yeah, I didn't even understand part 2 lmao
universe trifurcation, can't be me
I spent a few hours but gave up when my computed answer for the test input was off by a mere 7 orders of magnitude.
I knew from the reference to Dirac that ||quantum nonsense|| would be in part 2, but nothing like that.
12 โญ๏ธ here
Day 22 took me a while, but day 19 absolutely wrecked me
That took me 9 straight hours, by far the worst I did on any of them
My second worst was 5 hours for day 23
worst: day 22, 6+ hours unsuccessful attempt
2nd worst: day 18, 5.5 hours lmao
others are unattempted
@Advent of Code Good morning! Day 26 is ready to be attempted. View it online now at https://adventofcode.com/2021/day/26. Good luck!
wait wdym by day 26 , isn't it until day 25
it is meant to be a joke
lol ๐
lol
sir-lancebot#992
lmao
I'm taking AOC at my own pace imo
As long as I can find a solution
I just hope I can ask for questions even after December ends
Is #algos-and-data-structs appropriate?
you can always assign a help channel
You got slightly further than I did. I finished day 6, but didnโt start day 7 yet
lmao nice
I'm so inspired by this event, I want to make my own aoc called "are you smarter than a (snailfish) fifth grader," which would be basically 14 puzzles released over a week that only regard snailfish math
and each day is a higher grade ending at gr5
nO
lmao why not
We still have nightmares of that day
snailfish multiplication :evil:
I plan for the actual aoc puzzle to come at day 6 (with slight modifications), so it won't get much harder (because I can't make hard puzzles lmao)
but this is a project once I get more experienced. will probably start working on it in 2 to 3 months after I've done more aoc puzzles from past years
dew it
If you're seriously considering this hmu I can help make puzzles
damn right, i'm seriously considering this ๐
with help from more experienced people, we'd be able to make harder puzzles :DDD
i'd greatly appreciate you collaborating!
wanna help? it'd be great if we had a team, maybe we could even call the other cat devs
I'd love to help too ^^
i see fronto typing furiously
too late he already sent message lmao
Lmao
sounds fun
lessssgo!! perhaps if we get enough people and enough puzzles, we could ask event team to make this an actual event?
okay let's not get too ahead of ourselves lmao
Probably just do a trial run first to see how it goes ๐
yeah, my bad, got too hyped
But if we did make puzzles and what not, it should be its own thing and have a totally different concept than AOC
i've been thinking about this ever since day 18 released
of course
Did doing the homework for snailfish inspire you lol
i was simply inspired by snailfish lol
yep
if y'all want, maybe we can discuss details in a private server/group chat?
@muted aurora @woven sable @sharp panther sent y'all links!
On the contrary, I'm terrible at organizing anything, but making puzzles and programming challenges I can do
me too :)
I don't think the .aoc leaderboard commands knows my AoC user name, and can't place me on the leaderboard. Is there a way to link it?
with open("Day3\input.txt") as f:
lines = f.readlines()
lines = [line.replace("\n","") for line in lines]
def common(list,index,rule):
ones = zeros = 0
for bin in list:
if bin[index] == "1":
ones += 1
else:
zeros += 1
if rule == "oxygen":
return "1" if ones >= zeros else "0"
else:
return "0" if zeros <= ones else "1"
def pick(lst,common,index):
res = []
for bin in lst:
if bin[index] == common:
res.append(bin)
return res
def get(rule):
lst = lines.copy()
pos = 0
while len(lst) > 1:
lst = pick(lst,common(lst,pos,rule),pos)
pos += 1
return int(lst[0],2)
oxygen = get("oxygen")
carbon = get("carbon")
print(oxygen * carbon)
yo guys what can i improve on
in this solution
it's for the 2nd part of the 3rd day
bonk, not sure how helpful i would be, but would love to :D
hey can add me too ๐
Embrace the niceness that is list comprehension and generator expressions. With it kinda makes it hard to justify not inlining pick.
def pick(lst,common,index):
return [bin for bin in lst if bin[index] == common]
You could similarly do
ones = sum(bin[index] == "1" for bin in list)
zeros = len(list) - ones
also in your input reading you could do line.strip() rather than the replace.
Starting day 16 now. Keeping track of the length of packets is going to be a nightmare.
@proud cosmos I'm giving up on trying to optimize my Day 23, can you pls send your code, I'm just going to adapt from that to get the speed
is my day23 that fast?
mine's like 22s didn't you say you got it down to like 2s
its 5s atm not sure what I did

I also feel like I had that faster at one point
oh well
well either way still significantly faster than mine
and idk what I'm breaking with dijkstras
oh wait right your day 23 didn't work properly did it
it should now
it was me having weird seen
this is my code atm
I should remove the prints ig that would help
also heuristic is just 0 atm.
i still haven't found one that really worked..
I'm confused now why is my "is_finished" 4 permanently
that looks wrong

It gives the right result, weird.
oh that's just that one first check ig that's fine
Not sure why it being set to amount breaks it though this makes no sense sometimes.
so my is finished check being correct breaks stuff haha..
Yeah my day 23 code is just pure confusion for me now I am not sure what is happening
I should just rewrite this.
(it was heuristic not being 0 that broke it oops.)
my heuristic almost gives right result but not quite
:(
would be so good
well that seems essentially identical to mine, I meant more like the actual code to find the moves and stuff
I see
I'll just give you everythig just uh
its a mess
I can definitely make this better..
I'd assume the worst thing of your code is you using objects for the states right?
or am I misremembering
cause my stuff is just strings
even so
same issue for my C implementation, where I would suspect there's not much ovrhead since I'm hashing manually
I feel like there's some algorithmic thing I'm messing up
Yeah well.. I feel kinda bad for even showing you that code
it's a lot of things that have been created cause of other reasons but never fixed
like me going through rooms in reverse order is what I did cause I used to have this as a generator and that seemed smarter (?) now kinda useless especially since I search everything atm..
Also didn't know this was the non spoiler chat
oops.
Yeah I need to rewrite this..
lines = input.read().rstrip().splitlines()
cucumbers = [[] for x in range(len(lines))]
i = 0
while i < len(lines):
for line in lines:
for c in line:
cucumbers[i].append(c)
i += 1
#above can be ignored
k = 0
j = 0
cucumbers2 = [[]]
for line in cucumbers:
for cucumber in line:
cucumbers2 = move_east(cucumbers, k, j)
j += 1
j = 0
k += 1
can someone help me? I really dont understand how when i assign cucumbers2 to the result of move_east(), the list cucumbers changes itself?
its not like im assigning cucumbers2 = cucumbers, im only assigning it to a result of my function so i dont get how cucumbers2 and cucumbers are related
what does move_east do
(as in show the function)
it probably manipulates the original list
thats what i thought too, but then i changed the variable name and it still changed both lists
def move_east(cucumbs, pos1, pos2):
if cucumbs[pos1][pos2] == ">":
if pos2 == len(cucumbs[pos1]) - 1 and cucumbs[pos1][0] == ".":
cucumbs[pos1][0] = ">"
cucumbs[pos1][pos2] = "."
elif pos2 != len(cucumbs[pos1]) - 1:
if cucumbs[pos1][pos2 + 1] == ".":
cucumbs[pos1][pos2 + 1] = ">"
cucumbs[pos1][pos2] = "."
return cucumbs
its messy code but im just trying to get it to work
variable name doesn't matter
Yea
it's still referring to the same list
^
make a copy in move_east first, or similar
For 2d lists a bit annoying might be nicer to just change the solution to always use the new list
def move_east(cucumbers, pos1, pos2):
cucumbs = copy.copy(cucumbers)
if cucumbs[pos1][pos2] == ">":
if pos2 == len(cucumbs[pos1]) - 1 and cucumbs[pos1][0] == ".":
cucumbs[pos1][0] = ">"
cucumbs[pos1][pos2] = "."
elif pos2 != len(cucumbs[pos1]) - 1:
if cucumbs[pos1][pos2 + 1] == ".":
cucumbs[pos1][pos2 + 1] = ">"
cucumbs[pos1][pos2] = "."
return cucumbs
``` so like this?
nope, use copy.deepcopy
I would personally do something like
cucumbs = [row[:] for row in cucumbers]
ok thanks
Giving up for now. I just can't think of an algorithm that would work.
for?
advent of code 2015 almost done
I am at Day 23 almost getting it ๐
@digital ember @steel bear sent y'all links!
Hey there. I am trying to solve day 4 (got a bit late lol). So solving part 1 was very easy, but I am stuck on part 2. The final answer I am getting is too high. Anyone got any tips or something? Nvm got it
@woven solar
define(`strlength', `ifelse($1, `', 0, `eval(1 + strlength(substr($1, 1)))')')
strlength(foo)
this is m4
a macro language like the C preprocessor.
this is a recursive macro that calculates the length of a string.
look on in horror.
OH SHIT
THIS IS THE ADVENT OF CODE CHANNEL SORRY
man
i wanna get done with all my work for this christmas
so that i can begin solving aoc puzzles from prev years properly agian
bruh I just sat down and did days 1-18 in one sitting
2015 so ez compared to this year lol
https://m.webtoons.com/en/challenge/advent-of-code-2021/hydrothermal-venture/viewer?title_no=713188&episode_no=6
This is amazing
Advent of Code is an annual programming challenge running between Dec 1 and Dec 25. The set of 25 daily puzzles is accompanied by a story about saving Christmas. This year, I'm drawing a little comics from this story.
The story was written by Eric Wastl, not me, and I don't know yet, where will it take us :-). https://adventofcode.com/2021/about
only one i had to do research on was day 12 the JSON one, day 7 was my favourite how did you code it cus mine seems really inefficient but i like it ||https://pastebin.com/GkVCJF1d||
Since each wire could only get a signal from a single source, I did it backwards
started with a, and tried to recursively compute the things it was dependent on
that way I don't need to worry about any extra wires that don't do anything
i just kept track of the registers?wires? that had an integer value and then if another one used them i could then add that to the ints and iterate over them
I tried doing that too but since each of the things could be integers/wires it got a bit annoying the way I was doing it
and I was getting way too many wires when printing all the values out to debug
so doing it backwards helped with that
didn't spend too much time trying to think of a decent way tbh, just wanted to get stuff working
all my days are just basically hacked together LOL
I cheesed day 8 so hard lol, just used eval() and repr()
that day was so hacked lol, my day 7 was https://pastebin.com/4zYKQkLy
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
i used eval for p1, and for p2 used count, got it to 2 one liners for each part
count?
ah lol that's smart
...
how do i spoiler code?
||print(sum(len(s) - len(eval(s)) for s in open("Day8.txt").read().split("\n")))
print(sum(s.count('\') + s.count('"') + 2 for s in open("Day8.txt").read().split("\n")))
||
I don't think you can
i guess you get no syntax highlighting then lol
but this is why we have #advent-of-code-spoilers-archive
this is for 2015, I don't think many people are trying to do it I guess
WOAH! i know this is an old message but it's what i last read in this channel and that is so pretty ๐
what is the advent of code
I have completed aoc 2021!
๐
Yay, nice job!
I have completeted aoc day 4!
Nice! that day was a tough one
lol ive about given up on aoc this year now
my coding skills are not nearly that good
well, this can be a learning experience for them if you want it to
Hi
I completely forgot about this until now but I figure I'll do it as an exercise
this inspires me to do AOC 15 rn HAHAHA
Pretty fun isn't it?
oooh haven't done yet ๐
Try it if you have some time to kill, the first 15-16 days are all pretty easy
Can anyone please explain how to use advent of code
You create an account or sign in with something and then you just go to each day of the year you want to go to, get your input, the answer in the text box based off your input
Is that it?
Yep

how can i export the json data to a txt without 1 thing
the error shows your microsoft visual c++ is not updated, maybe try updating it ?
its updated
what version is your Microsoft Visual C++, the error message says 14.0 and above is required
why c++
its python
i thout u told me vsc
yes, its in the error message
ok dude ty
Windows Python needs Visual C++ libraries installed via the SDK to build code, such as via setuptools.extension.Extension or numpy.distutils.core.Extension. For example, building f2py modules in Windows with Python requires Visual C++ SDK as installed above. On Linux and Mac, the C++ libraries are installed with the compiler.
https://www.scivision.dev/python-windows-visual-c-14-required/, just did a google search ๐ ๐
ty dude ๐
Hello. Can someone help me understand day 7 problem? I don't even understand what I have to do ๐
You're given a bunch of x positions of crab submarines, you are given how much it costs for them to move along the x-axis, what's the minimum cost to get all to the same x position?
Alright so I understood that, but then I got confused by this example. Specifically, the three 2s in there
three of them are already at x=2
oh
so there can already be more than one at one point
there position in the list has nothing to do with the fuel cost right?
Alright thank you
if i need a sorted stack what library do i need to use?
Depends on what exactly you mean but probably something like a heap
not exactly sure how sorted and stack work together
tbh
idk data structures lol, what is normally used for dijkstras
heapq
a priority queue, thus the heapq library
For day 8 pt 2, do I have to like, read the sequence of strings on the left of the | and figure out what the pattern of the abcd is? Like its different for each line?
I'm working on the same task right now, and yea, each line is different
Join me in #advent-of-code-spoilers-archive to brainstorm how to figure this out? I have some ideas but I'm stumped
I was just giving it a read, altho I am going to have dinner rn. I will start solving it a few hours later. Mind if I ping you then?
Sure
Sweet
Complete noob, i was wondering if anyone could guide me with the seconds puzzle. I think i need to use array slicing but not sure
Do i need to delete /n from the text file
\n is a "newline"
I don't think it's part of the actual input in any of the days this time
so yeah you can just remove it
(well, or split at it, cause usually every line means something else)
how can can I remove or split it? @proud cosmos thank you
Strings have a .split method that does just that, removing probably with .replace

