#advent-of-code
1 messages Β· Page 47 of 1
Yeah, probably it's not nice for people to say it's easy if others are struggling with it - I'm a bit guilty of that...
No need to be mad or sad over anything π¦
What parts are you having trouble with? We may be able to give some hints in the right direction.
^ sorry about that
too many 0s, or something is not added correctly
Let's move to #advent-of-code-spoilers-archive and you can post your code and we can help you from there
I'd also recommend, if you aren't doing so already, checking with the test input
That way you can compare and debug
ok
Im checking
smaller one works
but larger not
I did have that as well
Ill post code in #advent-of-code-spoilers-archive
Turns out I did not read the question properly π
already did
same. i'm really struggling today and i think it could be just a bad day
you didn't lose aoc. you persevered, that's all that matters :) try again tomorrow, i'm sure you can get it!
Have a sleep and try again. I left mine for a few hours and came back and found it easier going. Sometimes you just get hung up on something silly, then you noodle your brain and, yeah. Take a break from it for a while π
Your code is almost there, I posted in the spoilers channel what you need to change. Message me if you need more.
As a general lesson for everyone: it was because of a mutable global variable. π Avoid using global variables.
just got fucked up by a final urgh
will see if I can summon the energy to do today's
couldn't yesterday
Go do yesterdays, it was a walk in the park and enjoyable.
Today's will likely be harder.
will have a look
I might not do anything. I'm so tired
No rush. They can be done anytime, even past years are still open. It's more about having fun and learning something.
fitty fye minutes folks
Yo, how were the past two days?
I had to study for my comp sci final
So I didn't have a chance to see
Ah lol
day 11 is similar to day 9
.aoc countdown
Day 12 starts <t:1639285200:R>.
π
π
1 min
.aoc countdown
Day 12 starts <t:1639285200:R>.
Good luck everyone!
good luck
gl
<@&518565788744024082> Good morning! Day 12 is ready to be attempted. View it online now at https://adventofcode.com/2021/day/12. Good luck!
letsgoooo
UGH
ew nope
fk
Guys no spoilers in this channel.
deleted
there is a whole ass wiki about it, crap
Well 17 stars this year for me π€£, not too bad
Hehe
no time to work on this tonight, dustin and charles are fighting (and amanda nunes lost wtf)
There's always a bigger Crab
I'm definitely still gonna keep seeing if I understand how to solve the problems, but this might be where things start to slow down for me lol
I just learned about this last month or else I would have been doing this for years
With your submarine's subterranean subsystems subsisting suboptimally
I got a stroke
i skipped that line
ezpz
damn today seems hard
kinda is π
Can the sub move backwards?
yes, note the very first example start,A,b,A,c,A,end travels from A to b back to A
oh, this started again?
happens every day (48mins ago on the hour) until christmas 
π
wont that just create loops?
ooh right you cant visit the small caves more than once
hmmmmmm
π
||not as bad as i thought it was going to be, probably because i got the pathfinding function done as early as i did||
is there any way to link my github to my aoc account
i think so
I think you have to have signed in with github in the first place (I used gmail and have the same issue)
think i'm getting better βΊοΈ
wow you got it in 20 minutes...
its been 1.5 hrs rn and ive still not gotten it lmao
tbf i closed discord while solving it.
oh my god i was right
u were π
oh no
YEAAAAAAAAAAAHHHH
oracle of delphi right here boys and girls
the microsoft of SAP
damnit, work to do
π
Why that
I suck at those
Path finding algorithms
Why NOOOO
i really freaked out when i first saw what the problem was
o-o
i stil
havent
done
p2
i thought i was gonna get muted there for a sec- π
FINALLY
DONE
π
i hv class so cant answer rn :(
and i have an exam today
so i dont think ill be answering today
I have two different terminal emulators which render the same character in the same font differently
wtf.jpg
smh is one of them kitty
the only terminal thats ever convinced me is luke smith's patch for st. and xfce4's. altho xfce4's got some problems on its own
3 hours and still nowhere near a solution π¦
nope. one is Alacritty and the other is iTerm
oh I love Alacritty
I like it because I like what st does and I hate suckless.
aaaaa luke smith
Yeah it's really nice. My main DE is alacritty, neovim, xmonad, and xmobar
it's a sweet setup
is DE supposed to mean something other than desktop environment
idk if it makes sense to use it here π
id say it makes sense here cause its
well
his desktop enviroment in the sense that hes got several pieces of software going for daily use
rather than a whole package
yeah that's my desktop environment
thats monolithic
that's how I've always heard people talk about it. Just XMonad would be a WM, and a WM plus other bits of software makes a DE
that's my understanding at any rate
including neovim in that probably isn't right but whatever
that is what a DE is
um... I don't think you can consider that a DE
we've got like.... desktop environment... and the environment of your desktop
isn't this just... semantics?
i mean if it's more comfortable I can just call it "the software I use that makes up my main environment" or something
but like
I thought you were referring to something else cause DEs are more complex than like terminal + WM Β―_(γ)_/Β―
that seems silly
I mean, doesn't the complexity of a DE just depend on like what DE you happen to use
No, there's some specification somewhere I'm pretty sure
indeed
Hey, does anybody have some test cases for day 5 solution two? I've tried three test cases and they all look good, but when I use my puzzle input, my answer is too low.
I feel like today is the biggest step in teem of difficulty
ah ok
hi
Hi
At least you didn't get fattly liver
π
ive seen ppl complain a lot about kitty, but i have done so many terminal graphics things and kitty works so goddang well for that :|
I've been using Kitty for very little and it proves to be nothing but pain
a lot of things like pkcon break because of it
and the scrollback buffer thing is trippy as heck
yeahhhh srsly
have you found any better terminals?
I love Alacritty, but it's goofy on latest KDE Plasma + Wayland
(that are good for terminal graphics stuff i mean)
hmm i have KDE Plasma + X11, ill try it i guess
I use Alacritty even on Windows lol
Alacritty is fine on Wayland (sway), must be kde then?
That's indeed why I said KDE Plasma + Wayland lol
it's a kwin thing, more specifically
oh dang alacritty works SUPER WELL for terminal graphics stuff
is it just me or is the website down
err, how does it work when your input loops back to the start
it doesn't, start is lowercase so you can't visit it twice
can I basically consider this path as null as start is lowercase and it is always getting visited?
righto

hmm for part 2 I am getting 54 on the sample input and I'm not sure why
i got 56 initially before i fixed it
Yo whats this π
lmao same
thats what i am debugging
π₯΄
implementing bonus on recursion is a bit tedious
π
actually i found where it fails
hm
the problem is to assign a exclusive bonus cave
and change it as soon as we are done with one path
all
in
recursion
smh
hush go to #advent-of-code-spoilers-archive
Just finished Day 12 π
congrats!!! i'll be now re-attempting day 11, hopefully i'll get it this time :P
ok - good luck! would love to see how it goes
Hhi
hold up- don't tell me i struggled two hours because the order of my code is wrong
something ain't right, i'm getting close
good luck
π₯΄ because i lacked luck today haha TOO much debug smh
aoc in a nutshell
broke: rich pretty girl
woke: rich pretty print
lmao i just realized how weird and out of context some programming words are
i am at the point of google search that if i just google "bruh" it will show
omg day 11 is so clear for me now wtf
i was just having a bad day yesterday lol
on to part 2!
Sleeping on a problem that you are stuck on is often very useful
OMG I SO AGREE!! once i was contribing to pydis and i just can't figure out why there's a heisenbug, and then as i was falling asleep my brain was like "hey man, did you flip the order of the two decorators"
and i did.
the eureka moment is so amazing
on to day 12!!!
So many times at work I went home frustrated that I couldn't solve something, and then waking up the next day the solution is so clear
It's crazy, like "why couldn't I see this before"
thats true π
sometimes i just wake up with the answer ready idk how lmfao
yep! i was so confused today as to why i was so confused yesterday lol. i gave up yesterday right before the solution, ||turns out i forgot to keep track of which octopuses flashed and that's it...||
very crappy nested solution currently, though, but given the newfound clarity of the puzzle i have today, i will refine it later
yeah, i couldn't agree more
:D
oh god, my solution has flag checking and redundant incrementing and everything lol
i'll do d12 first then come back and refine
You'll like d12 - ||you can do it recursively||
i will like the challenge, but i will hate the mindfk
recursion is always a love-hate relationship for me, i love trying to wrap my brain around weird things but i also hate the suffering that ensues (but then i also love the success after suffering lmao)
to love recursion you need to hate it first and to hate it you need to love it first
For me recursion is mostly hate but I will use it when it makes sense
Kinda like regex
i'm quoting this shit
whomst hath mentioned this unholy word
"to love recursion you need to hate it first and to hate it you need to love it first" - hsp, 2021
amazingly said
i ended up finding recursion a neutral thing
With your submarine's subterranean subsystems subsisting suboptimally the puzzle starts with amazing poetry
Hover over the text
this is the result of me reaching the base case of my recursive love-hate relationship with recursion
hm? nothing happens
It should. Might be a specific piece of it
submarine's subterranean subsystems subsisting suboptimally - hover over this piece
Yup lol
yes
Day 4 Giant Squid has my fave so far
omg
if you find the Star Wars ref
that only happens ||when you get all 50 stars||
unless
youve ||enabled that manually||
||no it works without 50 stars - 50 stars just shows where they are||
it definitely works
:(
THIS IS AMAZING
yup yup
I knew there was going to be an easter egg there the first moment I read that XD
okay i should probably spoiler the image
definitely lol
lol
i have no idea how that man manages to pull this off singlehandedly(almost) year after year
that is not a man; rather, a legend.
man deserves dedicated server to handle req π
Looking for small hint to day12 part 1 π° is this some sort of tree traversal?
hi all, i'm having some troubles with day 5. i've posted my solution in spoilers if anybody has any tips on where I may be going wrong
would there be an elegant way to transform this into a set comp? (day 12 minor spoilers)
||```py
caves = set()
for line in raw_data:
for cave in line.split("-"):
caves.add(cave)
||It can be, yes||
||caves = {cave for line in raw_data for cave in line.split("-")}?||
wait.
that's why...
thank you so much fronto, after not coding for months i legit forgot that chaining for clauses are reversed, i did ||caves = {cave for cave in line.split("-") for line in raw_data}|| because that seemed logical but it's invalid lmao
No problem, ngl I thought the same thing when I was first introduced to chained clauses a few weeks ago
it's confusing but I suppose it has to be that way because of how they're evaluated
omg so all the things i did before i could've used chaining for clauses
time to refactor
another reason to love aoc: revised comprehension knowledge
what is this called?
also you can chain ifs, [x for x in y if cond1 if cond2]
That's called a set comprehension I believe
me too
yep! although i believe using ands are more readable
mm
no i meant how you have both "for line in raw_data" and "for cave in line.split(..." in there
you can read up on comprehensions' syntax in the pyref, i read it months ago but i forgot all about it lmao
it has everything on for and if clauses
and chaining
and formal definitions
ahh, I should read it sometime tbh
https://docs.python.org/3/reference/expressions.html#displays-for-lists-sets-and-dictionaries if you would like to read :D
Thanks!
no probs
Puzzle is unlocked. I hate AoC. It works. I love AoC. Sleep. Repeat. :)
This is so true haha
agreed
gah
instructions too subtle
I missed the "single small cave may be visited more than once"
got part a) first try, then b) is giving me grief, so then i spend more time debugging printing out the actual paths than I spent coding the part a) answer, until I found a path that my algo found that wasn't in the toy data solution lol
solve it with iteration then. π
but this question feels awkward with iteration
i'm going to try it tomorrow regardless
Honestly recursion to iteration awkwardness is pretty bounded
You just use an explicit stack instead of the implicit call stack
Going the other way can be pretty awkward though for me
You just use an implicit call stack instead of an explicit stack π
Works great till you have an explicit queue lol
I don't know offhand how to write BFS recursively
just pop from the bottom of the call stack π₯΄
Lol
i think you might be able to use an iteratively deepening depth first search to get the elements you're looking for in the bfs order?
not sure i'm picturing it right
oh i should have just looked it up
https://en.wikipedia.org/wiki/Iterative_deepening_depth-first_search
IDDFS is optimal like breadth-first search, but uses much less memory; at each iteration, it visits the nodes in the search tree in the same order as depth-first search, but the cumulative order in which nodes are first visited is effectively breadth-first
It seems like less memory at the cost of many more function calls
But at any rate, what happens here is that the recursive part is still doing dfs
But you still have iteration too
seems like it gets what you would want out of bfs
i guess it becomes a little hard to say whether it's technically, pedantically a bfs without having a sharper definition of bfs than i think people usually have in mind; it can visit the nodes in the correct order which seems fine enough to me (and that looks to match how wikipedia defines bfs, for whatever that is worth (well it depends on what "visit a node" will turn out to mean pedantically, i suppose))
I don't see how this is spoilers, these are abstract algorithms
I agree it achieved the same goals as BFS
Bwahahahah....
But it is also slightly different, my main point was that exact transcription of a recursive Algo to iterative is very easy and natural
The other way less so
it's the lack of a queue that's causing the problems, right?
you can turn your loop into a recursion pretty easily
bfs or dfs can be done with a loop and a queue, pop left or right depending on which you're doing, recursive though I think you're stuck with dfs and backtracking.
Yeah it can certainly be done
Just with iteration, bfs or dfs is a one line change
Both feel very natural
And many intermediate searches, you just change the data structure
With recursion you tend to tie yourself to the call stack
I'd say this isn't always the case, for example consider the problem of postorder traversal of a binary tree
is it really that hard though?
S = [root]
out = deque()
while S:
n = S.pop()
out.appendleft(n)
S.append(n.right)
S.append(n.left)
Pretty much
Or use a stack for that matter
With recursive approaches there's always this implicit data structure there, even if it's not really the right one
Versus when you control it explicitly it's easy to use the exact data structure you intend, and easy to make that data structure a stack if you want to mimic a recursive algorithm precisely
Does anyone know when the timer starts for a day? Like I clicked on 2 to check it out and then did it later. Does it start when you click on the challenge?
the day starts at midnight US Eastern time (in ~2.5 hours)
it starts at midnight of that day
Ahh okay that makes sense
maybe not, but the transcription is not that similar to the recursive version
i agree there are cases where the recursive version is more natural, just saying the transcription one way I find consistently easier than the one going back
I also find that while recursive solutions can be more elegant for problems where they "natural", once you start adding weird conditions, more requirements, etc, making things just generally less elegant, more complex, it gets easier to shift to the non-recursive solution. Because, again, you can explicitly manipulate the data structure, which I think as the problem gets harder, is more straightforward than trying to arrange your recursive traversals just so
hi guys
Hey!
Good luck everyone
.aoc countdown
Day 13 starts <t:1639371600:R>.
gl!
whoop
I woke up literally 2 minutes ago, so this should be fun 
π
lmao same half an hour ago
begins in
3
<@&518565788744024082> Good morning! Day 13 is ready to be attempted. View it online now at https://adventofcode.com/2021/day/13. Good luck!
oops
what does the question even want me to do?
its too... difficult to comprehend the question
this ones easy but π
I always get offended when people say these are easy tbh
im stuck on day 1 smh
Lol
bro
this is dumb
i tried solution code and my code
my code was off by 1
Aoc is hard today
1 off
Tragedy π
How to activate the easter egg in day 12?
GAHH I have an exam now π
Ugh numpy has some stuff to make today's easy but I can't get VS Code to find it
I am sooo confused rn...
easter egg? :o
The elves had terrible handwriting
(I'm only on day 3 lol)
They succeeded in making all caps difficult to read
It doesn't matter just keep goin
They should add a light mode
yeah I don't expect or try to finish in December
this is my 3rd year and every year I do better than the year before :)
i used the private code to join the pydis leaderboard but it's some random's private leaderboard wth
What's the name of the leaderboard?
Daniel Brown, there's only 51 people in it
Certain staff members own the leaderboards, which the bot compiles into a single one.
I believe that's a staff member (edit: yes, it is)
What language does the first place global leaderboard use
i'm going to say rust
In part 2 do we have to tell the letters formed by the dots?
As long as your code isn't really slow to execute, the language you use isn't that relevant
I wouldn't really expect anything but Python/JS/maybe R in the tops - programmer time matters a lot here
ugh im trying to keep up with others
alright cheers thanks
ruby is amazing for golfing
trust me i learnt the hard way from codingame
right, ruby too
||how do i take the points and turn them into 8 capital letters|| im so confused
same
||you print them to the console and have a human read them for you||
||first of all i need to print dots and #||
i havent even done part 1 yet π
i insist on adding typehints, errors etc to my code
not ideal for golfing at all
are matrix diemnsions odd or even?
||desmos isnt telling me much||
what in the world is that
should've used excel
||i thought of plotting the points and seeing if they created letters but apparently not||
the only way
hint 1 ||y increases downwards, which means...|| hint 2 ||if you plot them on a standard graph the letters would be upside down||
2 doesn't actually follow from 1, and I think it isn't true
how can you even fold an even matrix like this
oh, I see what you mean, yeah, you're right MidZik
is it??
if u see
its split equally
yes
||You're not necessarily folding in the middle. You can fold at any point across the x and y axis.||
oh yeah
oh, yeah i guess that's possible
||Imagine folding a paper, you don't have to fold it in the middle||
i just realized what ive been doing wrong
||You have to draw the dots in the console and read it with your human eyes||
someone is going to use ocr for this
yay
not if you print prettily :P
wtf??
why is the entire column becoming '#'??
π
its working if i use a numpy array π π
How'd you do it?
||print("\n".join("".join("ββ" if x == 1 else " " for x in r) for r in grid))||
What does grid contain?
Out of curiosity, anyone know how many possible inputs/solutions there are? I only once got an error that I got "someone else's solution" and it made me curious
If you get 'that's someone else's solution' that means that the inputs are crafted rather than random iirc, but there's still a sufficiently large number such that you shouldn't know anyone else with the same input as you
Ah so it may vary from puzzle to puzzle? That's interesting...
because of this https://stackoverflow.com/a/44382900/
I believe that the majority of the puzzles have randomly generated inputs, with some more complicated ones (e.g. intcode programs, 2019; puzzles which output text, puzzles which are computationally expensive to generate) having either hand-crafted inputs (e.g. for intcode, Eric wrote an assembler which then had some randomised options for its assembly target) or checked random generation. I'm not familiar with the internal workings of AoC though, so I may be very mistaken
what character are you using for the output? it looks nice:)
0 if that coordinate is empty and 1 if it has a dot
GOSH IM SO STUPID LMAO
Thanks
whats your print statement look like i can get them to work with the unicode symbol
^
AoC shows the following example:
#####
#...#
#...#
#...#
#####
.....
.....
It then says there are 17 dots that are visible. Are there only 16 and it's a typo or am I stupid
is the dot
yes
5 on top, 5 on bottom, 3 on each side
or i forgot how to count
after 12 days either are possible tbh lmao
umm
ok so yeah it's the im stupid part LOL
that seems confusing 
it's bc at the bottom I assumed it counted the dots in the final square, not after first fold
carry on fellas, nothing to see here
yea it tripped me for a while too
Where are you printing it? It's very long and not printing in python idle
its not very large after the last fold
How many points are there after the last fold?
6 rows 40 columns
Oh, then I'm doing something wrong
thats just a representation for the final output
no code logic involved
spoiler please
still
okay
Let's err on the side of caution and put it in #advent-of-code-spoilers-archive anyway.
alright
Problem description interpretation is part of the challenge.
My first fold is coming correct but subsequent folds are getting messed up
omg, part 2 is amazing
How to hide decimal ticks in matplotlib?
https://i.redd.it/fh2k4hbcc6581.png this is so relatable
@hollow wharf You mean... Your algorithm goes through at least 100 iterations over a 10x10 grid in less than 1000 clocks cycle ? Stop bragging about that time and think
Man today's really can be done in like 10 lines and I actually used 100+
Well at least looking at concise solutions helps me to know what's possible
My brain is still in JS world where I can't rember how to do the equivalent of a map function
Capital mean UpperCase
but we are folding the transparent paper
should I see what the folded shape is and write that?
yes
@hollow wharf Sure what is blocking you ?
Is it too late for advent of code?
Nah
you can still come and play
And have a chance of getting into leaderboards from tomorrow.
hello. I don't suppose this is a spoiler but what's the most pythonic way of getting the input for Day 13?
@halcyon zealot all advent of code from 2015 are available. You can still join us discussing any day of the calendar you want
With open(path,'r') as file:
for line in file:
....
well, yeah. but like specifically for day 13. I was thinking manually appending to a list until you get an empty line, and doing another thing for the rest of them is probably not very stylish
What I did for today was :
line= file.readline()
while line != '\n':
....
line = file.readline()
for line in file:
....
I see π
You could also use :
if 'fold' in line:
......
else:
...
Boi, writing code on a phone is something....
i just did
points, folds = file.read().split("\n\n")
points = [list(map(int, p.split(","))) for p in points.split("\n")]
oh that's what I was looking for! thanks π
Ahah, I did not even know you could split an entire file
#bot-commands
That isn't splitting the file per se. .read() returns the contents of a file as a single string.
Of course, I am just always a bit stingy to parse an entire file at once.
AoC inputs are pretty small, so never think twice about just slurping it all in in one go π
I'm having trouble at part 2 of day 1 xd
Dealing with the edge of the array can be tricky if you did not do it before
In part 2 (day 12), we can visit one small caves 2 times, but rest of small caves (not visited 2 times) can be visited only 1 time?
I never did anyway
hmm that caught me out slightly
Hi, how can i solve day 6 part 2? Just for the example, there say there are 26984457539 laternfish after 256 days. The way i'm doing it is storing every fish as a number of days till reproduction, but that would mean that an array of 26984457539 8bit numbers use 25.13gb of ram. So that probably isn't the way to do it. So how can i do this?
||Store number of fish per day until reproduction.||
oh i understand now, thanks
Hey
Hey
@hollow wharfplease post even partial solutions into #advent-of-code-spoilers-archive
Ok sure
Another input to test on for the lovely people here: https://gist.githubusercontent.com/Synthetica9/df363a6038eb61a63cc71f805800b1a7/raw/316b50ccfc2d98719254e208f941d462df226e09/discord.input
god damn it
is it this much or the full logo π
full logo of course
wrote a tool to generate inputs
cool
(it's not that different from solving the puzzle, you're just doing the same thing in reverse with some randomness of where to put the folds)
@mossy basin can you use this input in your terminal simulation would be pog
yeah so you first decide the coordinates
and then the reverse stuff
yeah
i see
Is it true that weekends are harder?
Usually? Feels like last weekend wasn't that much of a difference. I expect this weekend to be a tough one
I need to still do todays
after making yesterdays
should it be easier?
like generally because difficulty is very personal here
it get's harder generally every day, but as you said it's a bit personal
but yeah, I'd reckon today you don't need to know any advanced topics to solve it
It's still in cs 101 phase in terms of algos it expects you to use, so nothing crazy
I don't think it will ever require anything you can't learn from a CS 101 either.
^
deeper knowledge makes it easier to racionalize the harder days, but ultimately a dsa/cs 101 and some intuition is all youd ever need
"racionalize"?
If you do remember those algos, even on the surface level, it's just a Google away for an easy starter implementation
Which makes sense. It's more important to remember "I can use this existing tool" than "I can remember how to build this tool from scratch and then use it" IMO
Yeah, knowing the type of problem you're facing goes a long way towards how difficult the puzzle will be
Hi guys is tutoring available in this discord? Or just general homework help for beginner python
Racionalizar, as in, optimize?
You're likely not going to find anyone willing to give you one on one tutoring, but you can check out #βο½how-to-get-help for how to open your own help channel and you will probably be able to get dedicated help with any particular issue you might have.
synonym of model [a problem's solution]
yes :)
Ah, I see. That definition didn't show up in my dictionary.
Maybe it's too technical.
huh, TIL
no
(not a native speaker)
It doesn't really convey that meaning in English.
no its not an actual word, i intended to say "rationalize"
Yeah, but not that definition
is reason a better alternative?
Well, the one you used "model a solution" sounds much better.
to reason about the harder days
The most common meaning of rationalize in English is to try to explain something away using logic in order to hide the true reason.
i see
It could work, I guess.
It makes sense, anyway. Whether it captures the same exact meaning is I guess hard to know for sure.
i guess so
Hi I am trying to write a programme with an outer function which takes three arguments from a user: apples, pears and oranges. Then trying to create an inner function within this outer function, which divides the apples by oranges? Anyone please help
this is the most dedicated I've ever been trying to solve a puzzle... call stack with call and pop order indices (starting at 1 for my easy understanding lmao)
I am determined to solve day 12
I'm officially stuck at day 9 part 2 it's awful
Looking for any tips?
Yeah because I can't find any optimal solution there
OK - will reply in the spoilers channel
I'm intrigued to see what you'll come up with π
i found yesterday's to be pretty tedious
it's a brain twister
is today part 2 just ||do all the folds||?
alizΓ©e had a very nice solution for yesterday
cool, thanks
FK YES
Nice!
now for part 2 π
what is that?
what you see when you solve an AOC problem
oh
i have a question
if data[index] == True
print("idk")
i dont get this
im so dumb and forgot
is it a array?
this channel is specifically for the Advent of Code website challenge
but if you open a help channel, someone can help you with that
ah yes, classic programming. when things don't work:
- increase/decrease indices by 1
- change
<=s into<s and>=s into>s
second worked for me :D
didn't know string answers were a thing
string answers?
well the answer for part two wasn't numerical
it has happened before I'm sure
yeah, there was a day in 2019 that i remember was quite similar
spoiled
||\s||
partridge dish is yellow?!?!?!?!?!?
major congrats mate!!! ππππ₯³π₯³π₯³
lol ty ||youβre like 3 months late but issok||
oh lmao my bad, i think it's because i haven't been on this server for some time (but then aoc came and now i'm pretty active again lmao)
what happens to this channel after christmas? 
It'll probably stay for a while, and then get archived.
I can show what it looks like with colors if you want
yes please :D
oh nice
and an underwater volcano
ah
k ima try to catch up a bit
For day 3, how can I delete all the lines with line[bit] being the lesser common number other than iterating through the list?
is list comprehension just the way to go
list comp is iterating through the list
o right
o2_common = "1" if count > 500 else "0" is it possible to have an elif in this as well or do you have to make it a long if, elif, else thing if you do add it
I think if you want to put an additional ternary in there, you'd have to nest it like o2_common = "1" if count > 500 else ("2" if True else "3"), right?
oh cool thanks
I'd double check that, I'm not very good at Python....just run it I guess
Yea it parses for me
might want to head to #advent-of-code-spoilers-archive
I thought that's where I was for second
oh sorry
.aoc countdown
Day 14 starts <t:1639458000:R>.
Good luck everyone
AAAAAAAA IM doing day 12 now
pause
refocus on day 14, you might even get points
but im so close π₯²
today feels like a leaderboard day
today feels like parsing hell
those are my best days
Doing day 14 now has a higher reward than doing day 12 now
GL
<@&518565788744024082> Good morning! Day 14 is ready to be attempted. View it online now at https://adventofcode.com/2021/day/14. Good luck!
first
second
seems ok
why does this one look easier than the last 4 days
lmao
do any of you guys
have any idea
how to do this
heh
im on part two
π
ok, part 2 neeeds servere optimization
yep
how is it
lanternfish have turned themselves into polymers
Lol
Good algorithms
a
hi
helo
how are you?
The polymers were originally required for the fishes to wear. They must have been running out of clothes.
That's why this problem came.
n o t g o o d
i dont know how to apply my knowledge from day 6 for today's puzzle
ok
GAHH I know I learned this in college but I cannot for the life of me remember...
:/
part 2 was sooooooo much harder than part 1
||It's the classic exponential problem with a bruteforceable part 1 and non-bruteforceable part 2||
||Like the lanternfish||
Would anyone be interested in a semi-reliable way to fetch the sample inputs for each day through a script as well?
I've no problem copy-pasting
It's not a problem, so I don't think it requires a solution
I feel it would complicate things, having to deal with the input grabber as well as the puzzle itself
But maybe it would be useful for those doing the challenges in the future, like grabbing them and an easy way to test the solution against them
||Is part 2 telling me to create an efficient CFG implementation or is it possible using a hashmap?||
hints only please. I want to figure it out on my own
well i'll tell you this at least: ||trying to calculate the actual string you'd have at the end is futile, it grows too quickly and will be very large||
||yes you can use dict/map||
Well, that's obvious lol. || I was thinking of a matrix power implementation with eigenvalues as counts of chars but I feel that won't work.||
what are those words xD
probably overthinking it
The solution is way easier than that
I'm not familiar with that field but I'm pretty sure that (small spoiler) ||someone made it work in some way||
That's literally the solution
which means it should be in the channel three channels down
fair enough
Interesting! Lemme think about it
At 999 days the answer gets pretty big, 6.78622117757187e+301
I dare you to find out the 999th character of the day 999 string
that's easy tho
That's actually also trivial computation time
Yeah isn't that hard of a challenge as I thought about it more
Is it trivial? How would you get the 999th character?
because of the way the string grows
Well after 999 days you can basically guarantee only the 1st pair of input matters
999x999 isn't big
and you can jsut throw everythingt away after 1000th char
the 1001th character will never affect the 999th character
Ah i see
Sure, I guess you'd need a little bit of a smarter implementation for that, I thought you just mean it's trivial from the regular implementation for the problem
It should be trivial
yeah the algo would be different
but that's because it's asking for something different lol
Python starts to hit integer size problems for me at 9999, need to go to alternate math handling libraries to go further
python has arbitrary precision integers
what are the max number of bits an integer can have in python 
just ran mine for 15000 steps, looks fine to me
There's a last operation for display that moves it out of pure integer math range
.aoc unsubscribe
Okay! You have been unsubscribed from notifications about new Advent of Code tasks.
Answer has 4500 digits lol
really? I'm getting perfect integer values
I was able to generate an integer with a million digits.
It was a bit slow, but it works.
right? you need time wizard and baby dragon
You need polymerase chain reaction!
yay i finally did it :D
this is not the right channel for your question, see #βο½how-to-get-help or perhaps for your question #async-and-concurrency
I thought that ||counting these at each step would work. I am dumb, I guess. Idk how I am supposed to get individual counts now || π€¦ββοΈ
Maybe it's possible
wait whaaaaa- π±
||If you have that consider if you could get the total amount of characters based on the rules the pairs are based on|| d14p2 solution part
||won't that count the letters more times than it should?
like CH and HH may count H twice what it should be||
||It may, could you get around that fact?|| Irrelevant without context
||Maybe don't count the pairs directly, but rather what each insertion contributes to what the string would be.||
||Didn't I do that though?
Like for the example NNCB
N becomes NCN and contributes NC and CN to the string, so I added to the NC and CN counted and subtracted from the NN counted||
||is it possible to add/subtract values of the pair array to get individual counts? π€¨ ||
#advent-of-code-spoilers-archive exists, yk :P
||yes, I know of 3/4 ways|| direct answer to d14p2 solution question
Also spoiler bars are redundant if you don't mark what they're spoilering. Otherwise people will click on them anyway just to see what's underneath
Fair
your statement ||"like CH and HH may count H twice what it should be"|| is quite close to how you can calculate it. hint: ||consider a single character in any given string. which pairs does it appear in?||
||What's the net effect to the string by applying a single insertion rule? How does the string change from before applying it to after?||
||Like, disregard pairs, just think of the string itself before and after||
||The solution seems to be half of all the counts of all pairs with that character in it. But Idk why that happens.||
If you want to know why, want to move to spoilers?
answering why would basically require telling you the solution
but as an FYI, there are other methods. dementati was hinting towards another solution that works, which is completely different from this method.
Not the one I used but one I think is maybe a bit more elegant.
yeah I think it is the most elegant too
FINALLY DONE
ffs stupid mistakes today
my code's convoluted af but runs both parts in about 3ms
Nice!
.aoc join
Impressive
i see exponential growth
i see a deceptively easy part 1 that can be solved by simulation using a string
hmmmmmmmmmmmmmmmmmm something ain't right
yeahhhhhhhhhhhhhhhh
flashbacks to lanternfish
truly
is this including the input parsing?
yes
that's pretty nyoom, can I see your code?
I'm just here to vent about being stuck π© first time I've been absolutely stumped even after sleeping on it
The cave maze did not bother you ?
Not really, just because recursion is my goto and gets me out of lots of situations even if I don't really understand why
this can be solved both|| with and without recursion.||
π in that case I might be able to intuit something
Woohoo
wait wait... I think I've stumbled upon something
I'm either about to have the biggest brain moment of my life or I'm going to cry lots and lots
this one was a tomorrow-morning solve
Turns out it was b) cry lots and lots
so i got the algorithm working
and it gave me the right answer
but when i put it into aoc it was telling me it was wrong
i was wondering why, and then i realized
i gave it the answer to the sample input
thats better
pain
thats why i fetch puzzle input using requests and overwrite it against the sample input by calling a function , so that saves time
Yeah, if I wanted to seriously compete I'd also do that next year
But that'd involve getting up before 6am an entire month
Not sure if I can handle that
part b) is definitely the first time I've genuinely been stuck as to basic approach this year
Anyone care to explain to me why with this code :
list1 = ["N", "N", "C", "B"]
for n in range(len(list1) - 1):
aa = list1[n] + list1[n+1]
print(aa)```
gives :
NN
CN
CN```?
!e
list1 = ["N", "N", "C", "B"]
for n in range(len(list1) - 1):
aa = list1[n] + list1[n+1]
print(aa)β
@muted aurora :white_check_mark: Your eval job has completed with return code 0.
001 | NN
002 | NC
003 | CB
Better
Trick question!
You might have something else messing up your loop
Did you save ? (just trying something)
I prefer me some:
for a, b in zip(list1, list1[1:]):
print(a+b)
I am not sure this is the right way to learn for a new programmer though
Definitely not
But looks cool tho
My point was that it eliminates possible indexing mistakes
Please spoiler partial solutions or keep them to #advent-of-code-spoilers-archive
introducing ''.join() would have been a bit more accessible for starter
joining 2 strings seems kinda weird
what ?
Seems kinda weird to do ''.join((a,b)) rather than just a+b if they're strings already
is it a spoiler if I'm working on the example?
Yes
You can solve the entire problem using only example input.
Everyone's input is different, so you can't spoil the final answer. The spoiler is the code, so doesn't matter if the input is the example or not.
I've done that multiple times lmao
The example is literally test data. It helps you know if your code is working correctly because you can easily just stick it in pytest or unittest and go from there
is it the cave system that is getting drawn in the main page?
For what?
it doesnt work for me
This channel is for discussion of the Advent of Code event.
ok
If you need help with machine learning, ask in #data-science-and-ml
ok
Starting to look like it. Maybe Eric has been playing some Subnautica this year π
I'm playing Below Zero right now, I feel very immersed in both.
waits for optimise crafting order with pile of raw materials puzzle
I need to finish Below Zero. I think I'm about half way through the story. First game was amazing, barely put it down π
I've probably put like 300 hours into both games in total.
It might very well be my favorite game of all time.
Gotta love a game that regularly takes you a on journey of absolute wonder, spine-tingling creepiness to abject pants-shitting terror π
I know you're purposefully stripped of weapons because of the developer's environmental ideals, but I'd be lying if I said I didn't feel like Russell Crowe in Gladiator after I killed a chelicerate by attaching myself to it with the grappling hook and punching it to death with the prawn suit.
lol!
It's not the most difficult fight in the world, but that thing had made feel such primal fear for such a long time, and that made the victory feel somewhat primal as well.
I always feel like a cowboy when I grapple onto leviathans and just punch them to death
This problem is going to drive me insane...
yeah, this is first one that took me a lot of thinking
Could someone give me some advice on todays P2? Without spoiling an actual solution, just some ideas on how to think, if that's possible π Spoiler: || So currently I just loop over the polymer template and match it with the pair insertion rules in a dictionary and then add it to a new list, and do this x-steps, so the solution "stops" after ~20 steps as the list with polymer becomes way too huge to continue. I was thinking about having the polymer as a dictionary and just store the amount of times the letter-combination appears, like "NB": 5, but then I will have issues counting the amount of letters in the end||
@eternal forge the thing you think is an issue is actually pretty simple. you're on the right track for sure.
Cheers π
I have a question about 2 codes im trying to find errors and corrections for. Would I be able to get assistance here?
Hello, can anyone tell what those grey stars mean? (this is from private leader board of this server). I made all 8 days in a row, and just interested why it does show for me 1 gray star. if anybody knows
grey stars mean only part 1 done
Oh wait, this list is updated every 30 min, maybe that is the deal. Totally forgot bout that. Sorry
just refresh the page, that one should update real time
Hmm, I managed to make the correct string, however it still goes slow as slime || At step 19 it's already too big defaultdict(<class 'int'>, {'NB': 487644, 'BB': 488137, 'BN': 477641, 'BC': 21601, 'CN': 18022, 'NC': 8020, 'CC': 10002, 'CH': 10604, 'HB': 14183, 'BH': 10002, 'HH': 6775, 'HN': 3196, 'NH': 3196, 'HC': 6423, 'CB': 7418}) π ||
@eternal forge probably just easier to discuss in the spoilers channel
that list is updated instantly
the command is updated every 30 minutes.
Okay, thank you :)
Just finished Day 14!
Nice!
I like how ||it's essentially Day 6 lanternfish but with a bit more thinking required||
i'm starting day 14!
thanks! although i'll actually be quite surprised if i solve this without any hints, i struggle on these efficient algo puzzles
makes me feel like in a coding interview lmao
mayhaps :p
Given that you solved the day similar to this one, I think you'll do fine π
didn't have time to do d13 π homework is being a major bruh moment
i'll complete all incomplete days once christmas break starts
day 13 doesn't seem too challenging, though (at least part 1 doesn't)
Ok I joined it
I'll never understand how 100 people solved this in under 15 minutes...
advent of code? congrats! welcome to the best programming puzzles you'll ever experience
i'll also never understand the 112 bytes solution to day 8
The leader board
ah nice
Is there any command to see score for a user ?
Which problem?
Imo the hardest was the 7 segment display
hello
the most complicated for me, but not the hardest
day 8 (7sd) wasn't hard imo, just pretty complex and long
Today's π© been stuck on it since midnight, got a little help in spoilers and I've got part of it now, just need to figure out the rest. The display one was relatively easy for me
The second part ?
but as the creator says, different days will be harder or easier for different people based on how their minds work and what experience they have
Yeah
Indeed. The one most people complained about last year, I found fairly easy - but then I got stuck on one most people found easy π
Yh it's a bit tricky one but I won't spoil it for you, just write it on pen and paper and closely look at each step
thanks, I'm so so close to getting it I just need to figure out how to COUNT UUUUGH
feels good to be able to vent in here though lol
i wonder how you keep a counter π€ ?
I just want to be able to step into the mind of the people in the top 100, see how their brains work things out so quickly. I wish there was a speedrun-esque recording system lol


