#advent-of-code

1 messages Β· Page 46 of 1

sharp panther
#

I'm not sure how to pass that in via curl, but I know you can get the token via your browser's dev tools

wispy glacier
#
AOC_SESSION='...'
aoc() {
    local year="$1" day="$2"
    curl --cookie "session=${AOC_SESSION}" "https://adventofcode.com/${year}/day/${day}/input"
}

^^^ not my code, @north silo's

wispy glacier
#

πŸ™ˆ

forest basalt
#

Ah okay I see, this may be a dumb question but does my session ID ever change?

sharp panther
#

It may change, but iirc, it'll live at least until the end of AoC 2021.

forest basalt
#

Ok awesome I'll test it cause I was planning on writing a script to just get the days input. I just started the challenges, how have y'all liked them so far?

peak dock
#

very cool

winter vigil
#

man day 10 is prolly gonna be hard

#

is it just me

#

or are even days harder?

#

7,9 were way easier than 6,8

white elbow
#

I didn’t think 6 was too bad after getting the trick

#

7 was really easy though

sinful pawn
#

I've not even done day 6

rancid creek
#

weekend days are generally harder, so day 4, day 11, day 18 probably

velvet stag
#

30 minutes left

humble copper
#

8 and 9 were difficult but fun to do

#

4 and 5 were just pain

north silo
#

.aoc countdown

hidden copperBOT
#

Day 10 starts <t:1639112400:R>.

wispy glacier
#

oo a countdown

north silo
#

You taking part today Mina?

wispy glacier
#

haha nope!

#

i haven't looked at aoc since last time with you

#

i shared your curl snippet above though

north silo
#

Ah right nice πŸ˜„

wispy glacier
#

glhf!!!

earnest forge
#

GL everyone

hoary canyon
#

Lx Try to get Rank 1 this time πŸ˜„

velvet stag
#

30 seconds left

north silo
#

GL everyone! lemon_sweat

stable heron
#

20 seconds now

#

gl :D

woven oriole
#

gl

north silo
#

10 seconds hemshake

hidden copperBOT
sinful pawn
#

oops

void ocean
#

lmao syntax errro

potent pumice
#

Syntax error in navigation subsystem on line: all of them
missing a semicolon

stable heron
#

tes

#

es

#

yes

woven oriole
#

brainfuck moment

hollow wharf
#

looks very regexable

#

today

#

lol

earnest forge
#

I didn't read the question properly :(

#

Still did pretty well though :)

narrow crown
#

was it easy

split niche
#

could have gone faster but I'm still proud of it

earnest forge
prisma sundial
#

nice finally back to the easy world of parsing

#

none of this recursive nonsense

#

actually i retract that, but whatever

narrow crown
#

tho wont be able to do it today cuz procrastination + school ;-;

modern harness
#

@earnest forge and @split niche Great job hitting the global leader board!

earnest forge
#

Tyty

humble copper
#

11 minutes god damn

earnest forge
#

but I could have been a minute faster :/

#

had I read the question properly

pearl needle
#

i hate when you submit a wrong answer but you find the error in 1 second

#

cooldown, please

woven solar
#

I check them on the tests

#

so I get less of that

north silo
#

@earnest forge @split niche Congrats! party_dog

pearl needle
#

yeah I should add test input

earnest forge
earnest forge
woven solar
#

setting up the tests takes maybe 10s for me - copypasting the test and the answers into variables I have set up

split niche
#

I have a test template but rarely use it

earnest forge
#

Not reading the question was the problem in the first place

split niche
earnest forge
#

also can we like not use the bot just before aoc starts

split niche
#

as the problems get longer, repeatable tests will become more necessary

ashen anvil
earnest forge
#

2PM? Must be nice to live there, it's 5AM here

ashen anvil
#

??? XD

prisma sundial
#

ouch

ashen anvil
prisma sundial
#

10:00pm for me, feels pretty optimal

ashen anvil
#

hmm

#

:D

hollow wharf
#

Welp, time to finally look into Haskell’s ||parsing combinators||

ashen anvil
#

Haha

late frigate
#

man I kinda blundered for part 2

#

I got a pretty decent time for p1

#

but then i got all my loop logic mixed around 😭

wide garnet
#

10:30am for me :P

clever pecan
#

was it just me, or was this one super easy?

wide garnet
#

it was easy for me too

frail sedge
summer parcel
#

both today's and yesterday's were things we specifically learned in data structures class

honest nacelle
humble copper
#

is it possible to complete all 25 days without importing anything at all

frail sedge
#

probably

honest nacelle
#

I mean technically yes, every language should be turing complete without imports. Practically, it might be a tall order

#

well, every popular language

sonic silo
hollow wharf
#

ugh trying to figure out how ||parsing combinators|| work in Haskell is killing me

#

I feel like they should give me a really elegant solution but the docs are so confusing

velvet stag
summer parcel
#

these feel like the kind of puzzles that would be in a puzzle book if they were only one of the lines of input, no?

summer parcel
#

I mean that they would be fun to do manually if it was only one line

#

in like a kid's puzzle book (or adults, tbh)

iron reef
#

the travelling salesman is a kid's puzzle if we don't introduce any concept of scale or generalisation

maiden brook
#

some people like to solve project euler problems with pen and paper

iron reef
#

Project euler problems rapidly stop being feasibly solvable by hand after the first page

sonic silo
hollow wharf
sonic silo
#

thats fair

hollow wharf
#

I'm coming up on my high score... last year was my first AoC and I got 25 stars

#

aiming for 40 stars this year

sonic silo
#

pog

#

i wanna get higher in the leaderboards this year

#

and next year i wanna aim for global

hollow wharf
#

hello

#

Can anyone help me

#

yes

hollow wharf
#

that's impossible

#

No it is POSSIBLE

#

how??

#
  print("By working and searching")
#

no

#

Why is {([(<{}[<>[]}>{[]{[(<()> incomplete and not corrupt?

sonic silo
#

what is this conversation

hollow wharf
#

he wants to hack facebook groups

#
{([(<{}[<>[]}>{[]{[(<()>
            ^
#

That should have been a square bracket

#

right

woven solar
#

this looks corrupt, yeah

hollow wharf
#

so it's corrupt

#

Yeah, but the example says it's incomplete and I can just ignore it for now

#

oh wait

#

my bad

#

I didn't read the following line lmao

#

Thought the remaining 5 lines were examples of incomplete lines

hollow wharf
#

you want to gain admin on a facebook group without them knowing?

#

no I just want to Joke with my freinds so I will make myself an admin in the group that they made

#

do you understand me Now

#

??

#

i don't believew

#

and that's impossible

#

yes you are right that's impossible

peak dock
#

We will not help with any project that attempts to do so in this server.

hollow wharf
peak dock
#

a moderator

hollow wharf
#

oh, my GOD!

#

Can you tell who made python that I thank him for making this lang

#

I love python as I learned it first

#

yaaaasss

#

!!!

#

~~so excited

peak dock
#

this discussion is also off topic for this channel

hollow wharf
#

ok

#

??

limber tundra
#

u kinda weird lol

hazy pendant
#

a reminder that aoc 2021 started with santa claus losing his sleigh keys

maiden brook
#

does the sleigh even have doors?

eternal forge
#

Todays task was fairly easy actually πŸ˜„ Compared to the last two days, phew

iron reef
#

i need these to be harder or i have no chance of making up the ground to the people above me

sonic silo
#

i feel like

#

its easier to just make a new sleigh in 25 days than finding the keys

#

and even easier to just break down the key system

hazy pendant
#

the key system uses RSA AES and every single cryptographically secure hash function in existence

sonic silo
#

you have access to the machine

#

that is teh sleight, nothing stops you from literally just

hazy pendant
#

it doesn't even stroe the keys

#

😳

sonic silo
#

taking all the circuity that connects to the keyhole

hazy pendant
#

the key has 1MB length

sonic silo
#

cutting it down and manually turning on the machine by making a bridge

#

like a car

hazy pendant
#

lmao

sonic silo
#

since they "dropped" the keys, they must be physical keys

#

not digital ones

hazy pendant
#

they dropped it from a server packet

sonic silo
#

packets cant drop physically smh

#

also the "key" cant be like

#

a pen drive or sth like that

#

since the water would just ruin it and thus ther would be no point searching for them in the first place

hazy pendant
#

lol

#

pov: christmas

maiden brook
#

maybe the keys operate the reindeer

sonic silo
#

therefore i suggest we never tell this to santa anyways for the puzzles

#

puzzles good

maiden brook
#

thankfully, christmas was saved by --preserve-root

hollow wharf
#

that's pretty cute

#

easy enough

#

less than 15 minutes, cool

hazy pendant
peak dock
#

Can we not share destructive commands please

#

people might run it without knowing what it does

hazy pendant
#

k

bright spindle
eternal forge
stable heron
wary wigeon
#

Is that 10th days input

hollow wharf
#

yes

sonic silo
#

i wouldnt say that works well

ember cargo
green heart
#

can i ask my qn for aoc here?

sleek cave
#

apparently today's puzzle is easier than the past 2 days, I'm skeptical

#

or maybe it's just because I don't know parsing

tight dune
#

it is easier

sleek cave
#

haven't-yet-plunged-into-language-design moment

tight dune
#

i feel anyway

#

i dunno how to make langs

rapid wolf
#

if you have ever touched a parser-like thing, it is trivial. If you haven't, it is kind of tough

tight dune
#

i nearly didnt solve day 8

sleek cave
#

woohoo, time to be tough then

tight dune
#

i can give u a small hint if u want

#

in dms of course

sleek cave
#

bring it on. I've tore my hair out for so many days, I ain't gon be stopped by a trivial parser puzzle (famous last words)

sleek cave
woven sable
#

oh

sleek cave
#

yeah, I just recursed, no fancy queue searching

peak dock
#

ye same

sleek cave
#

haven'tyettouchedlanguagedesign moment

rapid wolf
#

gl

sleek cave
#

this just shows how much aoc teaches me lmao

sleek cave
# rapid wolf gl

thanks! today is the beginning of the weekend, so I'll have 3.5 available hours to solve

#

should be enough

#

my usual puzzle completion time is 2 to 2.5 hours

bright haven
#

How ironic: this happened while working on today's puzzle:

cursive temple
#

xd

tight dune
#

LMAO

sleek cave
#

Lmfao

peak dock
#

hah

woven sable
#

Wait what's the joke?

woven sable
#

is it cause it's 3.10

#

no nvm

sleek cave
woven sable
#

I haven't started today yet so this flew right over me

sonic silo
#

lol

cursive temple
woven sable
#

oh

#

Are the remaining five lines always corrupted?

tight dune
#

wdym

woven sable
#

Like the remaining five lines of the input

#

Are they the corrupted ones?

fossil cipher
#

the inputs are either corrupt or incomplete. There's no OK ones

woven sable
#

Oh

#

Alright

#

Do you even need a parser for this today?

fossil cipher
#

well.. I say that... if there are OK ones I managed to filter them out by accident πŸ˜„

woven sable
#

||a simple stack would work ngl||

tight dune
tight dune
woven sable
#

One more question, if there's something like:
((<) would there be two syntax errors for an unclosed < and an unclosed (?

tight dune
#

read the puzzle

sonic silo
#

you just need to catch the first one

tight dune
#

it requires only the first one

sonic silo
#

as it is stipulated in the puzzle

fossil cipher
#

I'm fairly sure a line is either corrupt or incomplete. You won't get a combination

tight dune
#

even if it is both, you'll need to catch corrupt first

woven sable
#

Wait I see, Nevermind

#

so ((<) would say that an incorrect ) was used instead of >

tight dune
#

no, it would say no > found, ) found instead

low condor
#

Initial impressions of Day 10 looks pretty fun - this is more my kind of challenge

tight dune
#

ye

rapid wolf
#

I really do wonder if we will just have parsing AOC

sonic silo
#

yea

woven sable
#

I wonder if I should go overboard today and make a full parser for it

sonic silo
#

thats its own category of problems

honest nacelle
#

I did briefly try to dig into my lex and yaccc memories... but quickly gave up

low condor
#

Lark Parser is pretty awesome - but probably overkill for this πŸ˜‚

#

It made one of the previous years problems ridiculously easy though

rapid wolf
#

I am not sure Larks error reporting is powerful enough to be useful here

hidden musk
#

rotated counterclockwise 45 degrees

rapid wolf
#

thus far, the hardest one for me was the bits, though that was mostly because I was using a very slow language and was trying a clever solution, which was wrong

noble skiff
#

the bits one for me as well, i made every possible off by one error

rapid wolf
copper totem
#

i kinda dont comprehend what to do in day5

noble skiff
#

I've seen people already mention "pathfinding" in connection with day 9, I don't think day 9 really qualifies as pathfinding

#

pathfinding is usually about figuring out the shortest way to get between two points, given some data that specifies the cost of moving to intermediate paths. e.g. shortest paths algorithms on graphs.
I don't quite see how that applies to day 9 but maybe I'm missing something

tight dune
#

day 9 for me was a bit of a fluke
i tried something and it apparently worked

tight dune
#

except there are no walls (except for 9s)

noble skiff
#

that's a lot of algorithms though

tight dune
#

true

hidden musk
#

it's not really pathfinding, there's no path

noble skiff
#

pathfinding usually involves, finding a path πŸ™‚ We don't do that here

#

hehe

#

ninja'ed

tight dune
#

i guess this is exploration

noble skiff
#

well, maybe, that's a super loaded term but I don't have enough CS expertise to know if it's appropriate here

#

that's what I mean, you ninja'ed me

hidden musk
#

oop

noble skiff
#

πŸ™‚

hidden musk
#

😩

noble skiff
#

@copper totem what have you tried, where are you stuck?

copper totem
#

well im kidna new to programming and im kinda confused what it wants me to do

noble skiff
#

flood fill seems like a more correct term

maiden brook
#

it's literally filling basins with a fluid

strange zinc
#

What direction can I head in for day 9?

grand sail
#

Hello

low condor
strange zinc
#

1

low condor
#

Tricky to give a light hint without spoiling too much πŸ˜‚

hidden musk
#

wrong day 😳

low condor
#

Oof RIP

strange zinc
#

haha

low condor
# strange zinc 1

||You just need to look at every point in turn and find some way to extract its neighbours and compare.|| Again, more info would be spoilers, so happy to discuss in spoilers channel if necessary

steep shard
#

yay got both of the answers first try

woven sable
#

Is it just me or does the AOC this year really make me want labeled break and continue

low condor
#

What exactly is that? labelled break and continue?

noble skiff
#

basically means if you have a double for loop you can break out of both loops at once, or jump to the end of the outer loop from the inside of the inner for loop

woven sable
#

There was a PEP for this but it got rejected ;(

low condor
#

ah right yes

#

I had this issue yesterday

#

I could have moved this into a function and use a return instead

noble skiff
#

i don't think I really encountered it much

low condor
#

but I got lazy

woven sable
rapid wolf
#

you can do the oh so lovely and definitely not confusing

for _ in iterable:
    for item in iterable:
        break
    else:
        continue
    break
low condor
#

and just used itertools.product

#

to condense two loops into 1

noble skiff
#

yeah, always using itertools.product when it's applicable is a good move

low condor
#

Yup. So there's two solution here πŸ™‚

woven sable
#

!d itertools.product

marsh currentBOT
#

itertools.product(*iterables, repeat=1)```
Cartesian product of input iterables.

Roughly equivalent to nested for-loops in a generator expression. For example, `product(A, B)` returns the same as `((x,y) for x in A for y in B)`.

The nested loops cycle like an odometer with the rightmost element advancing on every iteration. This pattern creates a lexicographic ordering so that if the input’s iterables are sorted, the product tuples are emitted in sorted order.

To compute the product of an iterable with itself, specify the number of repetitions with the optional *repeat* keyword argument. For example, `product(A, repeat=4)` means the same as `product(A, A, A, A)`.
woven sable
#

Oh nice

hidden musk
#

in actual code, you can try refactoring one loop into a generator

minor cave
#

........ I feel AoC should check if the answer you put is the answer to the sample input, so it could then tell you "That looks like the answer for the sample data. Are you using your actual input data?"

low condor
#

If you use proper unit tests you'll never have that problem πŸ™‚

hollow wharf
#

Ugh I'm studying for my CS exam tomorrow

#

I hate this course so much

sleek cave
#

alright, time for aoc day 10

#

also, i have no idea how i'm having so much fun with solving puzzles lmao

#

i'm obsessed with collections

low condor
#

collections and itertools are key for AOC IMO

low condor
sleek cave
low condor
#

What's been your favourite day so far?

maiden brook
sleek cave
#

i do love aoc

sleek cave
#

least favourite is day 7, still extremely fun, but it was one of those "if you know the math, you can solve it; if you don't, well... good luck (or cheese with bf)" imo

low condor
#

That was a good one but my solution was very inelegant lol

low condor
sleek cave
#

i consider brute force cheese, but then again, If It Works, It Works ℒ️

low condor
#

Everyone has their own rules :)

sleek cave
#

true true

low condor
#

For me - it's only cheating if I look up a solution that's specifically linked to AOC

#

that's my own personal rule

#

If I write any solution to solve it, or I Google about resources not linked to AOC, then I'm happy :)

sinful pawn
#

I kind of agree. I do think it should try to catch onto that

#

else I'm stuck with 10 minutes of pure shame

pearl needle
#

10 minutes? is that the cooldown for submitting the third wrong answer?

low condor
#

I think they mean 2 x 5 mins? I don't recall having had to wait 10 minutes, but it's been a while since I gave two wrong answers

sleek cave
#

insane nesting lmao (code scribbled out to avoid spoilers)

#

the most important thing i learned from this year's aoc is that syntax checkers and autocompleters have scoring contests

#

||lmao i love how part two's text is half explaining the actual puzzle (finding completion sequences) and half trying to combine all the results into one submittable answer 🀣||

low condor
sleek cave
#

the actual nesting is 6 (not counting def level)

low condor
#

Ah gotcha

#

Still, I've seen worse before

sleek cave
#

lol yeah, in one of the days (8? 4? forgot) i got 8

low condor
#

8+ nests consecutive

sleek cave
low condor
#

So, not sure if you are familiar with unittest.mock

sleek cave
low condor
#

Ah cool cool

sleek cave
#

along with numpy, async programming, and web dev

low condor
#

Well, it might be worth learning testing during AOC

sleek cave
#

yeah, currently i just test using the sample input (sometimes even reducing it further down to just one line)

low condor
#

Right. You can use that to write a test that you run using a unit test runner

#

Anyway, the reason I bring this up

sleek cave
low condor
#

I think so, yes

#

Anyway, with mock you can replace any function or class with a mock object. That stops the function or class from doing what it usually does

sleek cave
#

oh

low condor
#

Typically you use it if you had a function that connected to an outside resource, like a database. You don't want to connect to a database during a test so you mock that code out

#

Anyway - you can use it with the with statement

#

Which introduces one level of nesting

sleek cave
low condor
#

But I saw tests that had so many mocks

#

and huge "with" staircases

sleek cave
#

oh god

low condor
#

Yup

#

Not pretty stuff

#

Also a bit of a code smell if you use too many mocks

sleek cave
#
with:
    with:
        with:
            with:
```withception
low condor
#

Yup exactly that

sleek cave
#

!otn a withception πŸ₯Ί

low condor
#

Nowadays there is better syntax for this

sleek cave
#

ah nice nice

low condor
#

You can do with a as b, c as d, e as f, etc

#

But even that would get long and you'd have to use backslashes to deal with them

#

With Py3.10 you can use parens instead, finally

sleek cave
low condor
#

Yup yup

sleek cave
#

making it much more readable

low condor
#

The with statements I saw were in 2.6

#

Which had none of those syntax additions

#

So it was that staircase

sleek cave
#

oof πŸ˜” must be a pain to read through

low condor
#

Yes so much lol

sleek cave
#

quick question, is there an efficient way to implement bidirectional dicts without creating a special class? instead of just making two dicts (or combining them into one, which is what i'm doing)

low condor
#

I was wondering a similar thing

sleek cave
low condor
#

I think there's a third party package that basically just does the work for you behind the scenes of using double storage

noble skiff
#

if you're not mutating it after creation, just create both dicts and call it a day

#

the storage overhead is irrelevant

low condor
#

bidict

sleek cave
low condor
#

!pypi bidict

noble skiff
#

I'm not even sure how much more efficient a bidirectional dictionary is actually going to be

marsh currentBOT
sleek cave
noble skiff
#

the real reason to actually use a bidirectional dict is once you start mutating it after creation

#

then it's just a headache to keep them synced. both in terms of efficiency and in terms of just forgetting

sleek cave
#

ah yes

noble skiff
#

like, how do you efficient delete?

#

you pass something that's a key into the first dict, and delte it there, but now you have to delete in the second dict where its a value

#

so naively you do linear search which is horrible

#

with a bidict you'd want to solve this properly, but solving this properly involves extra storage and indirections, so in reality a bidict isn't likely to be more efficient than two dictionaries for the simple case of not mutating after creation

low condor
#

For what we are doing, bidict is really not necessary unless you want to be super lazy lol

noble skiff
#

even if you're lazy. foo_to_bar = { ... } bar_to_foo = {v: k for k, v in foo_to_bar.items()} hard to beat

#

i had something like this for one of the problems

maiden brook
sleek cave
#

WOOHOO LESSGO

#

MY PERSONAL GOAL OF 20 STARS HAS BEEN REACHED

maiden brook
#

(within their respective sets)

sleek cave
#

okay, is it just easy for me or is today's puzzle so unstressful and uncomplicated

maiden brook
sleek cave
low condor
sleek cave
maiden brook
sleek cave
maiden brook
#

by efficiently I mean ||O(n)|| in this case, maybe you're already doing it this way

sleek cave
#

so yes, i'm you a few years ago

low condor
#

Had there not been unique values, you couldn't do that

noble skiff
#

yeah, but their comment was in response to another point I made

#

about how the naive solution doesn't work well once mutation gets involved

tidal beacon
#

im so confused by today, part 1. How can I know whats the first illegal char if a line is incomplete? Im looking at the examples provided and im clueless

maiden brook
low condor
noble skiff
#

ah yeah that's true

tidal beacon
low condor
tidal beacon
#

{([(<{}[<>[]}>{[]{[(<()> - Expected ], but found } instead.
This is the example

low condor
#

{([(<{}[<>[]} - the last } doesn't match with anything

#

For the line to be valid, it would need to be a ]

tidal beacon
#

Hmm I think I went about this backwards

low condor
#

Do you understand the ask now, though?

maiden brook
#

also, reading and deeply understanding other people's solutions helps a lot

tidal beacon
low condor
tidal beacon
#

Yea at least I understand the exmaple now ty

low condor
tidal beacon
#

Thanks, I'm gonna try for a bit more

hollow wharf
#

that's probably a bit spoiler-y for this channel

low condor
#

That's definitely a spoiler lol - no doubt about it

#

Probably best to spoiler tag this or delete it

daring dock
#

sorry I'll delete it

low condor
rocky oar
#

Phew, ive caught up from day 4 to day 10 in about 5 hours total

tight dune
#

πŸ‘ wow

#

quite a feat

tight dune
steel oyster
#

Still stuck on d10p2 😩

#

|| I'm getting the brackets in a wrong order :( ||

digital ember
#

||[::-1]|| spoiler

hidden musk
#

i'm tired af, def not gonna have a good time today

north silo
#

.aoc countdown

hidden copperBOT
#

Day 11 starts <t:1639198800:R>.

north silo
#

Who's ready? πŸ˜„

rancid mural
#

i'll be code-streaming to a commodore 64 discord i'm in, even though i'm doing it in python

hidden musk
#

i should have napped

mossy basin
#

who's ready for first weekend puzzle

north silo
#

Oh crap yeah 😬

hidden musk
#

last week was a weekend puzzle tho 😳

#

unless you mean the first one of this week

mossy basin
#

first weekend puzzle of this weekend

hidden musk
#

not me πŸ˜”

mossy basin
#

next weekend will be the hardest problems of the month probably

stable heron
#

o.o

#

oh no

jade atlas
sonic silo
#

checks out

jade atlas
#

.aoc c

hidden copperBOT
#

Day 11 starts <t:1639198800:R>.

woven oriole
#

GL!

stable heron
#

gl πŸ‘

north silo
#

gl

hidden copperBOT
sinful pawn
#

oops

rotund rapids
#

damn octopuses

ashen anvil
#

!

#

It's 2pm

narrow crown
#

hope its easy gl people who actually have time management skills

somber plover
#

o

#

yeah

rotund rapids
#

cool problem tho, seems like an optimization problem like the lantern fish

woven sable
#

||✨ coordinate dictionary time||

ivory ravine
#

ezpz

ivory ravine
woven oriole
#

the octopuses bursting dont get incremented ?

#

by 1 energy level after burst

#

idts

woven solar
#

Finally, any octopus that flashed during this step has its energy level set to 0, as it used all of its energy to flash.

mossy basin
#

that was a complicated ruleset

earnest forge
#

Honestly the rules were fine I was just a dumbass who indented to the wrong level and flashed every octopus every step anyway

pine tiger
#

BRUH

#

I THREW THIS ONE

#

SO HARD

stable heron
#

I'm getting recursion error-

#

oh weait

#

nevermind

#

nvm the nvm

#

im still getting recursion err

rotund rapids
#

make sure they aren't reproccing

candid berry
#

this doesn't feel like a weekend puzzle - it seems too easy for a weekend

stable heron
#

😭

candid berry
#

did you miss that a given octopus can only flash once per turn?

woven solar
#

can't be it, I think

stable heron
#

gosh this is confusing

#

im trying an OOP approach, would that be efficient?

woven solar
#

since even if an octopus would be allowed to flash twice, that'd never happen I think (only 8 neighbours, needs to gain 10 energy to flash again)

rotund rapids
#

like it feels like it should have a harder input or something

hollow wharf
#

does that mean extra hard one tomorrow lirikHMM cirSlain

candid berry
stable heron
#

huh

woven solar
#

even if you're, say, using recursion to propagate flashes - since no octopus can flash twice per turn, that means that a flash can propagate at worst 100 tiles (from top right to bottom left corner, say), so no way that can hit the recursion limit

rotund rapids
#

yea, I did OOP + recursion (did get stuck for like 30 minutes on a missing corner case), but yeah there's no way there is recursion limit without multiple flashes of same octo

stable heron
#

i think i know whats wrong... pithink

woven sable
rancid mural
#

i over-engineered mine by writing automated test cases first

#

but yeah i was a little paranoid, wondering if there'd be some weird exponential growth thing

#

i've been bit before

pearl moon
#

For this one I'd advise breaking up your code into exactly the steps the algorithm recommends

#

Don't try to do too many things at once. The more individual steps the better I think

rancid mural
#

i literally pasted the puzzle description into comments

#

that likely helped

#

i'm going to keep doing that because i'm terrible at naming variables

hazy pendant
#

wget

#

is wget useful for this

sonic silo
#

its juts like curl

#

so it can be used

stable heron
#

GAAAAAAAAAAAAH

#

typo 😭

#

now i need to wait for the timeout lmao

#

but im done finally 😌

sonic silo
#

that happened to me yesterday

#

painful

hazy pendant
fringe temple
#

Here, how does the 1 in the top left become 3? Since the 9 to the bottom right of it flashes once, shouldn't it be 2?

11111
19991
19191
19991
11111``` 

34543
40004
50005
40004
34543```

stable heron
hazy pendant
#

πŸ˜ƒ πŸ‘

#

i did 1 hour solving this :(

#

probably because lack of sleep

hollow wharf
fringe temple
#

oh right 😬 thank you

hazy pendant
#

Is there an input which it will never sync?

dusk cove
#

never all flash at once I guess

hazy pendant
#

never flash all at once

#

no i mean

#

is there an input

#

where it can't flash

#

all at the same time

hollow wharf
#

hey does anyone know a library to create applications

hazy pendant
hollow wharf
#

yes

#

@hollow wharf

#

ok then

#

thank you

hazy pendant
#

you can use numpy

#

for number stuff

#

use IPython/Python in itself if you're a REPL chad

#

jupyter notebook because yes

hollow wharf
#

thank you

#

@hazy pendant thank you so much!

hazy pendant
#

furthermore there's no standardized library for aoc

#

you can use aoc_helper

hollow wharf
#

ok

balmy dome
#

Lol

#

Code for nothing

woven oriole
#

😩

willow ocean
#

Today is an unexpectedly small input πŸ˜‚

rancid creek
hazy pendant
#

ah

#

is there one though

#

cause i feel like there's one

sonic silo
#

just as a reminder

#

last year' y2020d23 (the crab puzzle) did actually have inputs that could be solved without taking into account certain constraints

#

i say this cause i had to be a witness of such problem in my own input

mossy basin
#

here's visualization, it looks like the octopi sync up pretty quickly

sonic silo
#

this is

#

a rather itneresting pattern

white elbow
#

what tools are there for making visualisations for aoc, specifically for types of days that are suitable for a 2d array input

sonic silo
#

you could use anything for plotting. like matplotlib

#

altho for animations that might be a bit mroe complicated

white elbow
#

what's altho?

peak dock
#

"although"

rancid creek
# white elbow what's altho?

in case your seriously asking: it's probably short for the word although, and not actually the name of software.

mossy basin
#

should i add a way to paint on the grid real quick

sonic silo
#

yes

mossy basin
#

i feel like i should slow it down some too

white elbow
white elbow
mossy basin
#

nurses_2

hollow wharf
#

Part 1 doesn't seem that hard for a Saturday

#

Where's the catch?

white elbow
#

It took me so long of debugging though, but wasn’t very hard in the end

#

Especially the bridge from part 1 to part 2

mossy basin
sonic silo
#

nice

mossy basin
#

Doesn't really move past the boundaries much.

hollow wharf
#

^ seizure warning

mossy basin
#

yeah, maybe i should reduce the contrast in the gradient so it isn't so bad

woven oriole
#

can we not represent it as black background , and white flash

#

when it turns to zero

mossy basin
#

i did that and it's not as interesting to look at

woven oriole
#

oh

mossy basin
#

you'll see these flashes along the borders

#

i can show you

woven oriole
#

did you make square grid

#

ok

cursive temple
mossy basin
#

this is just the flashing ones -- i slowed the rendering down a bit so it's a little bit easier to see

woven oriole
#

i mean one square to represent one octo

mossy basin
#

actually, i highlighted the wrong one

woven oriole
#

there must be a moment when it is a full flash

#

lol

mossy basin
#

no, for random grids, the whole thing doesn't sync up

#

there are borders between synced spots

#

like certain regions get synced

woven oriole
#

i see

mossy basin
#

you can see the regions that are synced

#

our input was just specific input that ended up as entirely synced

woven oriole
#

some are out of sync

#

well its the same way as a monitor refreshes horizontally changing pixels from top to bottom, but their rate is too fast for it to not look asynced

wide garnet
#

😭 I'm finally done with today's challenge

restive imp
#

Me too, just finished

wide garnet
#

Part 1 was a pain

restive imp
#

Took longer than expected

wide garnet
#

Same

restive imp
#

yes, for me too

wide garnet
#

Part 2 took like 2 min fr me

#

Just adding a few lines of code

sleek lark
#

@wide garnet Mine took a long time because I forgot to put the flashing octopus at 0 ^^'

wide garnet
#

Oh

#

Mine actually had 2 issues lmao

#

First one is I took the || code from getting adjacent blocks from a previous solution but it didn't gihve diagonals ||

#

Second is something was wrogg || with setting the octopus at 0 for me too iy only worked for some. Luckily I had an array of visited nodes so I just set it at the end of the step after iterating through it again ||

ruby epoch
#

Doing day 4 part 1 and my unit tests are passing but my code is giving me the wrong answers... How the hell am I supposed to correct that

wide garnet
#

I actually printed all the steps from the sample input and started comparing them

#

To see if it matched

#

Because I got 204 from the sample input for 10 steps but it didn't work for 100 steps

ruby epoch
#

Gah, I'm so far behind. πŸ˜‚

sinful pawn
#

me too

#

I've yet to do day 6

ruby epoch
#

I'm stuck on 4A, although I plan to skip day 5 and go on to day 6 because it sounds relatively easier

hazy pendant
#

er, the timer for each... jellyfish?

mossy basin
#

octopuses

hazy pendant
#

right octopuses

#

anyways

#

make the timer limit 50 (or 100) instead of 10?

mossy basin
#

we could also increase the amount of energy flashing octopuses give to their neighbors

sonic silo
#

pulsating octopuses...

mossy basin
#

looks similar to 20 states version

#

really neat looking when you start taking energy away from neighbors instead

hazy pendant
peak dock
#

"states"?

proud cosmos
#

Probably means it counts till 20/100 before it flashes

peak dock
#

Ah

proud cosmos
#

Though I'm kinda disappointed none of the videos stay till they synchronize

hollow wharf
#

Is each pixel just the energy level of the squid, nothing else?

mossy basin
#

yes

woven solar
#

Is it common for states to repeat exactly?

mossy basin
woven solar
#

and if so, how long till that happens?

mossy basin
#

it happens pretty quickly

woven solar
woven solar
hollow wharf
#

That's cool how it looks like layers are out on top of each others

proud cosmos
#

Shouldn't they all sync?

mossy basin
#

for large NSTATES and low energy sharing, it stays more chaotic

proud cosmos
#

Yeah but I assumed over infinite time it always syncs

mossy basin
#

it doesn't

#

for a 10x10 grid, it will almost always sync

#

but this grid is much bigger

#

look at the boundaries

proud cosmos
#

Yeah but shouldn't the fact it adds +1 to the edges slowly advance the regions?

#

I don't quite see why they stay how they are

mossy basin
#

i don't know either, but the boundaries are stable

hollow wharf
#

Consider the states A, B, C and D and the following transitions:
A -> B
B -> C
C -> D
D -> B

If you start at A, you never loop back to A

#

It will always be cyclic but you can't guarantee it will loop back to where you started

mossy basin
#

and there are some states in cellular automata that can never be stepped to

proud cosmos
#

I mean it not going back to the start is fine but why isn't the cycle all flashing

covert yacht
#

what is the ceil function in python so example math.ceil

#

does anyone know

proud cosmos
#

ceil

covert yacht
#

yh

#

like what does this function do

proud cosmos
#

It rounds a number up

#

1.2 => 2

#

1.1 => 2

covert yacht
#

oh thx for the help

#

have you learnt python

mossy stream
summer kraken
#

111?

mossy stream
#

yes.

#

what leaderboard is the staff leaderboard?

#

we are in @minor cave's, dennis' and one named PythonDiscord

mossy basin
#

can play with the number of states and the energy sharing with some sliders

tepid raptor
#

cool

wispy glacier
mossy stream
#

alright

#

da heck the input is so smol

#

literally less than a minute for part 2

maiden brook
#

is today an off day? will tomorrow and the day after be much harder?

mossy basin
#

tomorrow should be harder, sunday will probably be easier? it's all kind of subjective anyway

hidden musk
#

true, if you didn't know what a ||stack|| was yesterday it was probably pretty rough

mossy basin
#

i think the iterative replacement is probably about as easy to write, even if it's a lot less efficient

prime ledge
#

can someone give me any link for practicing python questions for beginer level please?

humble escarp
peak dock
#

his own

humble escarp
#

Damn

noble skiff
#

From my narrow perspective this is probably the neatest advent of code yet

#

This kind of thing is related to rust I studied in grad school

mossy basin
#

i think i'll probably be partial to 2019 forever

noble skiff
#

Avalanching behavior

#

It's a whole thing in non equilibrium statistical physics

#

Barkhausen noise, random field ising models

humble escarp
mossy basin
#

it should if iterm uses vt100 escape codes, but i haven't tested it

torpid karma
#

Question about today part 1.
If a flash causes another flash does the original octopus get a value of 0 or 1?

#

wait would that be a spoiler? Tell me if it is i will take it down

#

nvm i looked at the examples cloesr

peak dock
#

once an octopus flashes, it will stay 0 until the next iteration

torpid karma
#

πŸ‘ thx

sleek cave
#

||also, octopus πŸ™ puzzle really just seems like a combination of basin and lanternfish lmao||

humble copper
sonic silo
#

pog

heady nexus
#

hey i have a noob question why do people who solve aoc in python use classes in the solution?

humble copper
#

for which day

heady nexus
#

generally for solutions

humble copper
#

oh

heady nexus
#

some people put everything in classes

humble copper
#

its just an easier way of encapsulating data

#

like for the crab one

#

every crab has the same data

#

so its easier for some people to throw that data into a class

heady nexus
#

yes i know but like

#

some people put absolutely everything into a class

earnest forge
#

Probably people coming from oo languages

#

who don't know how to use simple data structures

hardy zenith
sleek lark
#

@heady nexus Today I used a class because it made the processing much more neat

earnest forge
#

Yeah, [T; N] or Vec<T>

hardy zenith
earnest forge
#

Lol

hardy zenith
#

C arrays were clearly the pinnacle of computer science

earnest forge
#

malloc it yourself then

hardy zenith
earnest forge
#

πŸ€”

#

That isn't even valid syntax is it?

hardy zenith
hardy zenith
#

you need to specify the type for global statics

earnest forge
#

Doesn't it have to be static RAM: [usize; 1048576] = [0; 1048576]

hardy zenith
#

with const generics, I think you can specify N as a const expr

#

which 1024*1024 would be

earnest forge
#

Fair but 1048576 is fun to type

hardy zenith
#

goes back to powershell 1mb ahhh nice.

heady nexus
#

oh that's spoiler probably

hardy zenith
#

can't wait for my vacation to start

heady nexus
#

yeah i haven't solved beyond 4

#

not enough time

earnest forge
#

just cut into your sleep time smh

hardy zenith
heady nexus
#

already doing that because of school

earnest forge
#

For me aoc is 5am so I have time to wake up, do it, and sleep again before anything happens in the day

heady nexus
#

for me it's 6 am so it's not that bad

hardy zenith
#

ah, ability to wake up at 5am, must be nice πŸ˜› I'm usually asleep by midnight and then kids wake us up by 7AM

#

and aoc releases at midnight my time

hardy zenith
#

I tried to stay up for it last year and compete, but I had no brain power at the end of my day

#

so I gave up about 10 days in

#

I did manage to be top 1000 several times, so that felt nice

earnest forge
#

My dad's given up on doing it at 5am this year

#

So far every year I've completed I've got points which is nice

#

2019 was especially good because of intcode

hardy zenith
#

those intcode challenges are what got me interested in building compilers

earnest forge
#

I don't think it's possible to compile intcode because of its self-modifying nature

hardy zenith
#

right, but the idea of turning instructions into something executable via the intcode vm

#

was cool, inspired me

earnest forge
#

Ah, as a compile target

#

Yeah that's a neat idea

#

compile python to intcode so I can interpret intcode while I interpret intcode

heady nexus
#

one more question how do you handle input? do you load it directly from the file?

hardy zenith
#

in Rust, I just use include_str! and be done with it

earnest forge
#

I use a (cached) input fetcher

hardy zenith
#

which will compile a file content into the binary

heady nexus
#

I'm used to sys.stdin.readlines() and then parsing the input inside the terminal like python file.py < input.txt but I think it's unnecessary for AOC

earnest forge
#

That reminds me of the c/c++ solution that #included their input into an array

heady nexus
#

Is that bad? Not very experienced in C++.

hardy zenith
#

it's just a different way

heady nexus
#

oh okay thx

hardy zenith
#

an alternative would be taking the input file as an argument to your script and learning how argparse or click or some other package works

heady nexus
#

well I like to manually enter input because I can test the solution easily on those shorter inputs provided in the puzzle

hardy zenith
heady nexus
#

thanks I'll check it out

hardy zenith
#

the built-in unittest module might meet your needs as well

heady nexus
#

oh okay

hardy zenith
#

!d unittest

marsh currentBOT
#

Source code: Lib/unittest/__init__.py

(If you are already familiar with the basic concepts of testing, you might want to skip to the list of assert methods.)

The unittest unit testing framework was originally inspired by JUnit and has a similar flavor as major unit testing frameworks in other languages. It supports test automation, sharing of setup and shutdown code for tests, aggregation of tests into collections, and independence of the tests from the reporting framework.

To achieve this, unittest supports some important concepts in an object-oriented way:

hardy zenith
#

!d argparse

marsh currentBOT
#

New in version 3.2.

Source code: Lib/argparse.py

Tutorial

This page contains the API reference information. For a more gentle introduction to Python command-line parsing, have a look at the argparse tutorial.

The argparse module makes it easy to write user-friendly command-line interfaces. The program defines what arguments it requires, and argparse will figure out how to parse those out of sys.argv. The argparse module also automatically generates help and usage messages and issues errors when users give the program invalid arguments.

heady nexus
#

@hardy zenith which one do you think is the simplest?

#

(to use)

hardy zenith
heady nexus
#

yeah that's true

bright spindle
low condor
#

Just finished day 11

#

Was worried that part 2 ||would be one of those ones where they ask you to simulate a bazillion steps|| but it was not

mossy basin
#

"Find a closed form solution to day N"

sonic silo
#

closed form?

#

oh

#

kinda wish i could pick more math subjects in college

jade atlas
woven oriole
#

is closed form == generalized form

#

for any day N

#

hm

#

function of N

noble skiff
#

yes, it is possible

#

there's only a finite number of days, so the value of the function is only constrained at af inite number of points (25)

#

(well, or 50, if you considered part a) and b), you could make f(1) == day 1 part a), f(1.5) == day 1 part b) )

#

so e.g. a polynomial with 50 terms would do it

mossy basin
noble skiff
#

you lost me

#

also: ugh, they changed the definition of "neighbor" from day 9 to include diagonals 😦

mossy basin
#

update your KERNEL!

sleek cave
#

||recursion again?? big bruh moment||

peak dock
#

i didnt use ||recursion|| today heh

placid lake
#

||no recursion for me||

sleek cave
#

||guess i just need to get good then lmao||

#

||ever since i used recursion on day 6 my brain keeps on jumping to recursion||

humble copper
humble copper
sleek cave
#

lmao

#

day 8 was a ||set fest||

low condor
#

I try to avoid ||recursion|| as much as I can lol. And then the one time I used it this year, turns out I didn't need to....

sleek cave
#

ugh so much boilerplate for identifying adjacent items of an item in a matrix

#

wonder if there's a simple, pythonic way of doing it (other than 8 if statements or an unreadable loop)

hidden musk
#

linalg πŸ‘€

sonic silo
#

why are there ||so many attempts at using recursion today, on an obvious devouring algorithm||

hidden musk
#

what's ||devouring algorithm||

sonic silo
#

||its actually not Exactly a devouring algorithm but i feel like the logic behind its code structure is similar. you can just take a set of all candidates to be processed (aka the flashy squids), process em and keep going until its empty. you may add candidates during the process, while ignoring the already visited candidates||

#

||my point is that recursion overcomplicates the problem in this case||

mossy basin
#

i didn't see if any of those solutions were simpler or not

mossy basin
sleek cave
woven sable
#

oh

#

i should have used cool concepts

sleek cave
#

turns out the unreadable loop wasn't so unreadable and turned out quite clean :D

woven sable
#

i just did ugly nested lists and for loops

#

I should start making my solutions elegant tbh

#

i was gonna do OOP yesterday but i thought i was going to get ruined with a naive solution

mossy basin
#

i often think the OOP solutions are over-engineered

sleek cave
#

oops the loop broke for corner cases (quite literally)

#

rewrite time

mossy basin
#

lol

sleek cave
#

oh right, because lexicographical comparison sucks

#

sadge

#

back to ugly ands and deleting my amazing tuples

woven sable
ember cargo
#

Hey

#

I've been struggling, can someone point me in a direction of what I should learn to take on the challenge today?

sharp panther
ember cargo
#

If I had

4 7 5
9 9 9```
I see how i'd increment each by 1 to get ```
9 10 10
5 8 6
10 10 10``` but then seeing which would flash?
humble copper
#

ok cool

ember cargo
#

I tried looping for ints above 9 and then looking at adjacent positions and doing += 1

#

But then for those that spark I'd also have to += 1 to the adjacent ones to those as well

#

So I tried it via recursion and got a recursion limit error

cold ferry
#

perhaps use a data structure to keep track of what needs to be processed instead of recursion

ember cargo
#

I also tried that

#

A list of coords which need to increment by one and then incrementing them all by 1 afterwards

#

But then some of those became >9 so wouldn't that just lead to an infinite loop?

cold ferry
#

when you process a new point in the grid you might have to add yet more stuff to the data structure to process later
there should not be an infinite loop (if you do it correctly, ofc), every octopus flashes at most once per step and there are a finite number of octopuses

low condor
low condor
dusk socket
#

one thing that helped me was to use an object for the octopuses

#

one variable was their energy level

#

and the other was a bool for whether they've already flashed

#

you can also do it with a list, but I wanted a little extra clarity

#

in what I was doing

low condor
#

Yup, I did the same thing

#

I knew I could use a tuple but I like classes - nicer to use attribute access

cold ferry
#

i think you don't need to keep separate track of whether each one has flashed if you schedule a point to flash when you see it hits exactly 9 energy (ie, if you increment its energy from 10 to 11 you know you've already scheduled it so no need to do so again)
but i suppose it doesn't hurt

mossy basin
#

just had an array of booleans keeping track of flashed

ember cargo
#

But it still flashes

cold ferry
#

i guess this depends on the details of how you do it; on my implementation the top left would have to go through 9

#

imo if it's confusing the suggestion to keep track with an array of bools or whatever is fine too

sleek cave
#

k fk recursion, i'm solving this iteratively

ember cargo
#

That's my attempt so far

sleek cave
#

AY YO

ember cargo
#

But what's confusing is that it's returning values way too high

sleek cave
low condor
#

that's probably too much for this channel lol

ember cargo
#

Oh

#

Sorry bout that

sleek cave
low condor
sleek cave
# low condor how's that going for you?

i tried recursion at first because this seemed suspiciously similar to day 9 ||and i solved that beautifully with recursion||, but now i'm having second thoughts since i'm not making any progress

#

me brain is also lagging today for some reason (not enough sleep? idk, just not very clear)

#

so now i'm trying iteration. if that doesn't work then i'll look back to recursion :D

low condor
#

you use recursion quite a lot lol

#

Not sure if Python is the language for you πŸ˜›

sleek cave
#

scoff really enlightened me, perhaps a bit too much

low condor
ember cargo
#

And I've still not solved d11

low condor
ember cargo
#

My brain's just stuck in limbo rn

#

I've rewritten the same(ish) structure of code out abt 6 times since morning

#

And no luck

low condor
#

Python is basically - use iteration unless it would be awkward to, then use recursion

low condor
sleek cave
noble skiff
#

fwiw I think recursion is super natural on today's problem, regardless of language

#

And yeah, it is extremely extremely similar to day 9

fossil cipher
# ember cargo I've rewritten the same(ish) structure of code out abt 6 times since morning

For some reason I really struggled today. Didn't help I have been a bit distracted. Wasted a couple of hours debugging only to realise I got two variables backwards. Annoyingly my solution actually worked up to about 10 steps on the example input, so couldn't work out what had gone wrong!

I decided on a more OO approach (not perfect, but let me move some logic out of the way). Turns out doing that made part 2 trivial.

Moral of the story: Maybe don't do a coding puzzle when busy πŸ˜„

ember cargo
#

Yah

left path
#

I struggled a bit when I tried to do it at night when it first released, then after a good nights sleep I managed to do both parts in like 10 min

pale heath
#

and after 11 days, I lost

#

aoc

sleek cave
#

i'm having a bruh moment day

#

my logic is fuzzy, i'm tired, everything is bruh

#

i'll attempt 11 and 12 tomorrow

woven sable
#

I wonder how hard tomorrow will be

#

given today was a weekend puzzle and wa easy

low condor
#

Yeah - I was expecting more difficult today

woven sable
#

Hopefully tomorrow if it's harder will be parsing

#

and we don't need another board

#

frankly i'm getting tired with these board puzzles

loud yew
#

yeah....

devout tusk
woven sable
#

today I think I just used a dictionary

pale heath
#

why everyone keeps saying today is so easy if Im nowhere near start