#advent-of-code

1 messages Β· Page 22 of 1

magic oxide
#

i actually get to be here at the start for once

pine tiger
#

pog

modern terrace
#

timer set up so i can be reminded that aoc exists

magic oxide
#

13 mins left

#

enough time for an integral

minor cave
#

Language Roulette: Day 24
The language is ... Rust

magic oxide
#

damn fenix was right

dim pivot
#

We haven't had any hard days this year

#

Today will probably be the first

#

Well day 21 was hard but it was more that it was a difficult trick rather than hard or long to code - the code was still very short

magic oxide
#

i found the past couple of days decently hard, but not as difficult as previous years

dim pivot
#

Yes it was hard but nothing compared to days 16/19/22 last year

magic oxide
#

feels like the difficulty got evened out with the early days being harder

modern terrace
#

T-00:00:15

magic oxide
#

glhf

shut trellisBOT
sweet star
#

ok

plush peak
earnest forge
#

Oh god

#

GLHF everyone

sweet star
#

thanks for the luck (Im not doing it)

hollow wharf
#

yea so looping over 200 trillion numbers is most likely not the case 😨

woven sable
#

how hard was day 21 wtf

#

the leaderboard filled in an hour

hollow wharf
woven sable
#

what was it

#

i'm not doing aoc this year so i'd be fine w spoiles

modern terrace
#

how do i math this

magic oxide
#

oh god

#

not this

naive stone
#

:C

jovial jay
#

um, looks like a very skippable day methinks

fleet fox
#

yep,,, im gona skip this probably

#

πŸ’€

dim pivot
#

YAY!!!!!

#

MATHS

fleet fox
dim pivot
#

Today was a great day πŸ™‚

#

44/6

fleet fox
#

gahd damn

tall wasp
#

how do i maths

dim pivot
#

I can't say what I did though

fleet fox
#

how do u maths

#

teach me the ways, i suck at it

dim pivot
#

I'll tell how once it's over

earnest forge
magic oxide
#

i blundered that p1

shrewd thicket
#

holy shit this is hard

pine tiger
#

i'm sorry wth

#

i'm getting wa for some reason

earnest forge
#

I've clearly got an edge case I'm missing because I get exactly the right answers for the test but not for the real input

pine tiger
#

LITERALLY ME

#

stackoverflow lied to me 😭

earnest forge
#

OH

#

I forgot to finish the check I was writing LMAO

dim pivot
royal hound
#

Hailstone A: 19, 13, 30 @ -2, 1, -2
Hailstone B: 20, 19, 15 @ 1, -5, -3
Hailstones' paths crossed in the past for hailstone A.

#

wtf does this men

#

mean

dim pivot
#

That the paths don't actually cross

#

If they moved backwards they would cross

royal hound
#

is the order in which you compute the paths relevant?

pine tiger
royal hound
#

oh

#

ok

pine tiger
#

that's python's problem πŸ’€

dim pivot
royal hound
#

thx

dim pivot
#

Only use floats to extract answer

tall wasp
#

how are those parallel? if the one has a vx and vy of double the other's?

dim pivot
#

Yes but the unit normal is the same

earnest forge
#

OH HELL NO P2 is AWFUL

dim pivot
#

The direction is the same

dim pivot
tall wasp
dim pivot
#

No

#

Well they can

earnest forge
dim pivot
#

but p1 - p0 is not parallel to the vector as well

#

so they don't collide

tall wasp
#

alright i just think i dont understand the math

#

maybe i shouldve gotten more than 4 hours of sleep

magic oxide
#

wtf is p2

jovial jay
#

now, i think i'll just have to try this since it's so bad, but am i going to regret it? eh, i'll hold off then.

pine tiger
#

wanna see ur sols

dim pivot
#

No

#

Sorry

#

I can send you a particular day if you want though

#

Just not todays until after the lb clears

magic oxide
#

i have no clue how to even approach p2

#

other than just solving it with math somehow

pine tiger
#

bro i'm getting fricking ratelimited

#

advent of waiting

earnest forge
#

I tried to ||shove it into z3|| but that didn't even work

jovial jay
ivory vigil
#

I don't even know where to start on p2

#

I'm with you, Stickie. 100% with you.

earnest forge
#

LET'S GO 612/28

#

don't accidentally push it to my repo lmao

ivory vigil
#

314/confused

magic oxide
#

did u ||z3?||

pine tiger
#

what the hell??

#

i'm still geting wa

#

actual scam

magic oxide
#

i dont even have code for p2 yet

pine tiger
#

my brother in christ i haven't even finished p1

earnest forge
#

Did you ||only remember to make sure one dimension was in the test range||? That's what I did for p1 lol

earnest forge
#

As in, ||I calculated the line segments where start <= x <= end, but forgot to then verify the intersection was in a valid y||

pine tiger
#

IT GIVES ME DIFFERENT ANSWERS EACH TIME

earnest forge
#

:thonk:

royal hound
#

time to get the paper out

#

im prettttty sure i can spam lin alg for p2

earnest forge
magic oxide
#

im trying to spam linalg for p2

royal hound
#

LOL

jovial jay
#

it still haven't opened?

#

this is a long one folks

royal hound
#

lb is half full

pine tiger
#

NO

#

WRONG ANSWER AGAIN

ivory vigil
#

sigh
Would it help if ||there were parallel lines||?

earnest forge
#

For p1 or p2?

flat sequoia
#

Bruh I'm sick

#

And then had a 5 hr plane ride

#

Want to die rn

pine tiger
#

weren't you just on a plane a couple days ago

flat sequoia
#

Yeah

jovial jay
#

get some rest then

tall wasp
#

OH MY GOD WHAT THE HELL IS PART 2

minor cave
#

I'm rooting for y'all! and totally not just because I want to sleep

rancid creek
#

still only 62 people on the leaderboard. p2 is a doozy. I suppose there might be some cool math involved.

jovial jay
#

i learned from day 5, can't wait to see what's in part 2 math-wise

rancid creek
#

I'm going down the wrong path for sure. lol

ivory vigil
earnest forge
#

There aren't any colinear ones, I'm pretty sure we have some parallel ones though

pine tiger
earnest forge
#

Bad.

#

(well actually not that bad I did get 28th global)

ivory vigil
#

πŸ‘€

earnest forge
#

Colinear means on the same line, parallel means going in the same direction and will never meet

#
parallel
----
    ====

colinear
----====
ivory vigil
#

Yeah. I think I checked for parallel in my data, not colinear. I only looked at velocity (3D) and not the starting position.

minor cave
earnest forge
#

Oh yeah I don't think I checked if they were parallel in 3d that's fair

ivory vigil
#

p1 explicitly has parallel lines. In x-y.

pine tiger
#

STILL WRONG ANSWER

#

I'M GOING INSANE

ivory vigil
#

p1 or p2?

dim pivot
#

There are 2-3 ways of doing it

#

I used the most scammy way ||z3||

#

Other approaches include ||binary search/big step small step on the velocities until 3 boulders meet at a point, then it's easy to get the position||, ||chinese remainder theorem, assuming the collisions are always integers||

earnest forge
#

Though honestly I don't see how ||CRT|| is useful here, but maybe that's just because I don't understand it lmao

pine tiger
#

hooray,,, i guess...'

magic oxide
#

im gonna sit here and contemplate the problem until i figure it out

#

i refuse to ||z3||

pine tiger
#

mfw idek wth that is

flat sequoia
#

Oh bruh they want you to

#

ignore the Z axis

ivory vigil
pine tiger
#

how do i even solve this system of equations

#

it isn't even linear

flat sequoia
#

Fuck it

#

it's z3 time

pine tiger
#

am i the only one here who doesn't know wth z3 i

#

is

ivory vigil
pine tiger
#

i mean what's so bad about using it

magic oxide
#

nothing

#

just don't want to use it

fleet fox
#

what is ||z3||

ivory vigil
#

There's nothing wrong with it. But it's much less satisfying to me.

naive stone
#

lmao just read part 2. I was not expecting that

#

if the story from this year was turned into an anime, i'd watch it

pine tiger
#

man what a crappy day

flat sequoia
#

frfr

pine tiger
#

i miss when it was just "implement this"

tall wasp
earnest forge
pine tiger
#

i was too young for intcode

#

i hated it as an hs freshman

#

and that hate has lingered

naive stone
#

that's a shame

#

it's definitely the best year

ivory vigil
#

I never completed IntCode. When there were parallel stuff going on, I solved it with async and that ended up biting me hard a few days later.

#

I really ought to go back and start that over from scratch.

earnest forge
ivory vigil
flat sequoia
#

Turns out you only need three

mossy basin
#

intcode was my first year and my favorite year

covert arrow
#

I'm back from skiing today

#

I can finally start aoc

rancid creek
covert arrow
#

why is ||sympy|| so slow 😩

#

I have to make my own ||linear equation|| solver?

lucid narwhal
covert arrow
#

for p1?

lucid narwhal
#

p2

#

p1 can be done without any other libs needed

covert arrow
#

but that requires thinking

lucid narwhal
#

πŸ—Ώor an equation from stackoverflow

rancid creek
rancid creek
feral hazel
#

aaaa i missed a ||linalg problem D:||

rancid creek
#

rewrote my part 1 using shapely. Turns out it's pretty snappy.

from shapely.geometry import Point, LineString
class Hailstone:
    def __init__(self,x,y,z,dx,dy,dz):
        self.p = Point(x,y)
        self.e = Point(x+dx*10e15,y+dy*10e15)
        self.l = LineString([self.p, self.e])
hail = [Hailstone(*eval(x.replace('@',','))) for x in open(aocinput)]
s,e = 2e14,4e14
part1 = sum(s<=inter.x<=e and s<=inter.y<=e for h,k in combinations(hail, 2) if (inter:=h.l.intersection(k.l)))
mossy basin
#

solution isn't too bad though

proud cosmos
#

this is so bad Sobb (the day)

lime fulcrum
#

hey can someone help me out with 19? ||I have all the different spaces where valid combinations are in but they overlap and its not a size where I can just put them all in a set||

woven oriole
#

me when probably magical intertia

atomic cairn
#

How have the last days been in difficulty

#

Last one i was home was 18

lucid narwhal
#

usually needs a more targeted approach

atomic cairn
#

Any extremely hard days

mossy basin
#

day 21 part 2 is extremely hard

#

imo, though it has a simple solution

atomic cairn
#

Oh well guess im gonna be in for a fun time

#

I have to finish day 5, 12 and 18-25 in a month so i can get help in the aoc channels lol

#

But atleast i understand whats going on in day 5 so im almost done solving that

lime fulcrum
#

@mossy basin do you have a hint for 19 2?

cosmic tartan
#

I said I was gonna start doing aoc like 2 weeks ago and never started, and now I feel guilty πŸ₯Ή

atomic cairn
#

Its not to late

woven solar
#

oh my god

#

just spent like 10 minutes debugging my day24p1 solution thinking "this should be trivial, how come I'm getting wrong answer", then realised I flipped the sign of a single term when transcribing from notepad, which flipped the sign of all my times πŸ˜”

woven oriole
#

aw

#

i am almost at the brink of solving part 2

#

i just need to ||guess the upper bound for time?||

#

because ||it looks like it would take forever without an upper bound||

#

context ||z3||

#

πŸ₯΄

modern terrace
#

HOW DO I CHECK RELIABLY FOR PAST/FUTURE?>????

woven oriole
#

hol up

#

does time have to be integer for p2?

#

it isnt mentioned

#

fuck around and find out time

woven solar
modern terrace
#

like do i just do ||(inter_y-y1)/rise1||

covert arrow
#

||if vx > 0 then collision x > initial x and vice versa||

woven oriole
#

mfw when i solved day 24 after d1 d2 cauz sem exams inbetween

finite musk
#

||was it cheating that I used z3 for p2||

honest dune
#

Hey guys can anybody help me with Day 10? I am confused about this:

..........
.S------7.
.|F----7|.
.||OOOO||.
.||OOOO||.
.|L-7F-J|.
.|II||II|.
.L--JL--J.
..........

Why are the 8 tiles marked as 'O' . It does say "In fact, there doesn't even need to be a full tile path to the outside for tiles to count as outside the loop - squeezing between pipes is also allowed! Here, I is still within the loop and O is still outside the loop:" but I did not get it

covert arrow
#

there's a 'corridoor' between the Is which connects the O to the outside

finite musk
#

day 10 got me fucked up dawg

#

||when I attempted it two days ago I came up with an algorithm that should work on a continious space but on a discrete grid there are just waaay to many fucking edge cases to think about||

honest dune
#

wtf did i just read

mossy basin
lime fulcrum
mossy basin
#

oh i was thinking of day 20

#

what was day 19

lime fulcrum
#

The one with finding the amount of combinations

mossy basin
#

oh, uhh, i wrote a recursive solution

lime fulcrum
#

I did recursive to get all valid paths and the ranges the x m a and s can be. Problem is there are overlaps and I don't know how to deal with that

mossy basin
#

what do you mean overlaps? you mean you have multiple, say, xs and the ranges overlap?

#

you can combine the ranges maybe, like (2, 10) and (5, 12) combine to (2, 12)

lime fulcrum
#

As in I have list of every path that gets accepted. And then I get the ranges. So I have a path with x(1,100) m(500,600) a(40,300) s(300,600)
I can get the combinations for that.
But a second path x(1,100) m(550,650) a(40,300) s(300,600) shares some of the combinations so I can not sum them up

mossy basin
#

you can combine those two sets of ranges though

#

into x(1,100) m(500,650) a(40,300) s(300,600)

#

if all the xmas intersect, there should be a simplification into non-overlapping ranges

lime fulcrum
#

x(1,100) m(500,600) a(40,300) s(300,600)
I x(50,150) m(550,650) a(40,300) s(300,600)
What about something like this?

woven solar
#

after doing linear algebra for an hour I've proven day24p2 is impossible, whoops

mossy basin
#

lol

lime fulcrum
#

If you add them then I think you have extra combinations that do not work. Or i might be wrong

mossy basin
lime fulcrum
#

Yeah 4d cube intersections are a headacheπŸ˜…

covert arrow
#

is it necessary to simplify intersections at all?

mossy basin
#

it would look like:

x(1,50) m(500,600) a(40,300) s(300,600)
x(50,100) m(550,600) a(40,300) s(300,600)
x(100,150) m(550,650) a(40,300) s(300,600)
#

i think

#

i didn't need to simplify

#

but i could see an algorithm where'd you'd need to

zealous basalt
#

4d is a real head scratcher, when i made 4d models i fought and fought against cell normals

mossy basin
#

missed an x

lime fulcrum
#

It's a lot of numbers to simply put in a set. Think it's something that finishes within a reasonable amount of time?

proud cosmos
#

i would expect it to finish in under 24 hours

mossy basin
#

you can do it just with endpoints, it's just a product of intervals, so if you can do a single interval intersection/simplification you can do 4

proud cosmos
#

but also intersections for that day didn't seem too hard to me maybe i lucked out

proud cosmos
#

like ||none of the instructions ever add anything to a range they only ever split it, so if you split it correctly there cannot be any overlap||

lime fulcrum
#

Maybe I am doing it wrong. I am basically tracing the conditions for every possible path with gets accepted. And some of the conditions during a path overlap

lime fulcrum
proud cosmos
#

||technically conditions overlap but those are self contained in the instruction so you could just solve that||

#

||like if you have {x>1000; x>500} that techncially overlaps (1001-4000) (501-4000) as condition but you can clearly see that after the first one it only has 0-1000 left so the 2nd one should jsut be (501-1000)||

#

||so it should still result in no overlaps in the end imo||

lime fulcrum
#

I will have to think about it some more. But your input helped a lot

proud cosmos
#

gl AuroraCheer

honest dune
#

omfg i done day 10

#

first time running into "Segmentation fault" in python

#

C flashbacks

#

Idea was

#

||expanded_version = { '|': [ ['.', '|', '.'], ['.', '|', '.'], ['.', '|', '.'] ], '-': [ ['.', '.', '.'], ['-', '-', '-'], ['.', '.', '.'] ], 'L': [ ['.', '|', '.'], ['.', 'L', '-'], ['.', '.', '.'], ], 'J': [ ['.', '|', '.'], ['-', 'J', '.'], ['.', '.', '.'], ], '7': [ ['.', '.', '.'], ['-', '7', '.'], ['.', '|', '.'] ], 'F': [ ['.', '.', '.'], ['.', 'F', '-'], ['.', '|', '.'] ], 'S': [ ['S', 'S', 'S'], ['S', 'S', 'S'], ['S', 'S', 'S'] ] } and solve like part one with some modification||

woven solar
#

lmao, just noticed something

#

the fancy animated fluids on the aoc main page for this year eat like a full CPU core for me

magic oxide
#

WE WIN THESE

hidden musk
#

poggers

magic oxide
#

im genuinely so happy about this

#

code is hideous

#

ok im gonna need to pastebin

#

!pastebin

marsh currentBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

magic oxide
#

lots of debug stuff but

#

it works

#

oh wait

#

wrong chat

pine tiger
lime fulcrum
magic oxide
#

it's been the same day for me

pine tiger
#

even then

#

the fact that you spent what

magic oxide
#

8 hours

pine tiger
#

6 hrs

#

lmao

magic oxide
#

tbf i had dinner for 2 hours

#

it was worth it

#

the amount of happiness i got from finally solving it

lime fulcrum
#

the later problems of aoc just kind of make me feel stupid XD. probably a bit out of my skill level

pine tiger
#

if it makes you feel any better they also make me feel stupid

lime fulcrum
#

yes but I've been going at this one problem for days and it turns out i did a lot of unnecessary thinking

rancid creek
lucid narwhal
modern terrace
#

is there something about the intersection formula i'm missing in p1

rancid creek
# pine tiger if it makes you feel any better they also make me feel stupid

Sometimes I feel like it's like Jeopardy (the game show). The concept is you ask questions from a lot of categories. Viewers at home feel smart cause they know most of the answers.
But the challenge is that there are questions from a broad variety of topics, and it's rare to find someone that knows all of them.
Like last night's was probably a lot easier for people that ||remember the math or are working with math|| a lot. But maybe they struggled with the pathfinding problems earlier.

pine tiger
rancid creek
#

||you need to keep in mind that line intersection formula consider the line extending in both directions. you only extend in one for this problem.||

rancid creek
#

||for the full data did you remember to change the area? And you're using including the boundary?||

modern terrace
pine tiger
#

are you using numpy

rancid creek
rancid creek
modern terrace
sleek cave
#

part 1 of today doesn't seem bad at all. first thoughts give me this approach: ||get the equation of a line for each hailstone, calculate each pair's POI (if their slopes are different), see if it lies within area||

candid berry
#

Sounds right to me

sleek cave
#

wait a damn minute

#

can ||trajectories be collinear|| lemon_eyes

#

if somebody actually answers please put it in spoilers lol

#

i'll err on the side of easy, so no ||collinear lines|| :P kinda wanna have the surprise of getting this edge case

magic oxide
#

||collinear as in they travel the same path?||

sleek cave
#

as in, if you expressed ||their trajectories as equations of lines||, with no extra properties, you can plug em into desmos and they show up as ||the same line||

#

which messes up my logic outlined above

magic oxide
#

||probably not, because of p2 reasons||

sleek cave
lime fulcrum
woven solar
naive stone
#

any d24p2 hint givers around?

woven solar
#

d24p2 hint: so far I've only seen one solution that didn't involve a bunch of linear algebra (only as much as p1 does) πŸ₯΄

naive stone
#

i would like to do whatever solution that is lol

#

i'm happy to brute force if that's possible, i just can't understand how one would

woven solar
# naive stone i would like to do whatever solution that is lol

then the (big) hint is: suppose you have two hailstones whose lines don't intersect, and they also ||have the same velocity along an axis, let's say the axis is the x-axis and the velocity is v||.
Then let the rock's position and velocity along that axis be x0,v0. Then the collision equations are ||x0+t1 v0 = x1 + t1 v, x0 + t2 v0 = x2 + t2 v||. Then we can subtract the two equations to get ||(t2-t1)(v0-v) = (x2-x1)||. Then, and this is the fun part, suppose also ||collision times are integers|| (there's no reason why this must be true, but it's in fact true in part2). Then this implies ||x2-x1 is divisible by v0-v||, which gets you a finite set of possible values of v0. And in practice, there are enough rocks that doing the same for each ||group of rocks with the same velocity along a given axis|| lets you narrow it down to a single solution for v0 along this axis. After you have the rock's velocity, there's another trick to to get a component of its starting position, after which getting the full starting position becomes simple.

atomic cairn
pine tiger
#

who here didn't use a CAS to solve p2

ivory vigil
atomic cairn
#

I learned more maths this aoc then in school lol

ivory vigil
#

I was embarrassed and surprised at how much geometry I had forgotten in p1. I also had vx, vy, vy = data which took a while to debug.

naive stone
woven solar
#

the idea of this solution comes from @mossy basin and I too had to think of it a lot and implement it before I convinced myself it actually works

#

my own solution was, uhh, the same as most people's. tons of linear algebra and a CAS.

pine tiger
#

? if you use a CAS idt much is needed after

magic oxide
#

tons of linear algebra ftw

naive stone
#

damn, it's still not clicking for me. I feel like i have a mental block or something

woven solar
#

is there a specific point at which it becomes unclear?

naive stone
#

i think i'm struggling with what each of the variables represent. As well as what it's actually calculating

#

i can't get past the thought of if i were to be solving this in one dimension. the fact that between two hailstones, there are infinite starting positions and velocities in which I could intersect at infinite points in time?

#

or not 2 hailstones but rather a single hailstone and the rock you're throwing is what i meant

#

it becomes finite when you need to collide with multiple hailstones

woven solar
# naive stone i can't get past the thought of if i were to be solving this in one dimension. t...

hmm, here's a maybe more intuitive explanation: ||if you have two hails moving with the same velocity (along an axis - let's forget about the other axes entirely), they are stationary with regards to each other. The rock is moving with regards to them though, and passes first through one, than the other. The collision times, we assumed, must be integers - so the time the rock moves between hails is an integer too. But that means a certain divisibility - if the distance between hailstones is 55, the rock's velocity relative to the hailstones must divide it, otherwise it can't be at one hailstone at one integer time and at the other hailstone at another integer time. So the rock's velocity relative to the two hails can be Β±55, Β±11, Β±5, Β±1.||

naive stone
#

hmm

modern terrace
mossy basin
#

it narrows down pretty fast

#

my incomplete solution just had like two or three guesses to make, and it wasn't using the complete set of diffs

woven solar
naive stone
#

so this hinges on ||there being multiple hailstones that have the same velocities for the same axis?||

woven solar
#

yup

#

in my inputs there's tons

naive stone
#

if we had hailstone a have an px=5 and a vx=-1, and then another hailstone b of px=3 and vx=-1, what are the possible velocities of our rock?

modern terrace
woven solar
# naive stone if we had hailstone a have an `px=5` and a `vx=-1`, and then another hailstone b...

you also need to check that ||they don't intersect (this is an important requirement, because otherwise it's possible the two hails and the rock all intersect at the same time)||, but assuming so ||the rock has to cross a distance of 2 over an integer time, so relative to the hailstones the rock's velocity has to be Β±2 or Β±1, and to move back to the global frame of reference we add vx=-1 to all 4 possibilities, getting 1,-3, 0,-2||.

woven solar
naive stone
#

assuming i calculated that right, i don't actually know how to get that answer programatically, I kind of just did some trial and error in my head

mossy basin
#

you do some trial and error in a loop

naive stone
#

lol

woven solar
#

||relative to the hailstones, the rock can't move at a velocities of 3, because then it can't move by 2 in an integer time||

naive stone
#

so ||1, 0, and -2|| are valid velocities too?

crisp obsidian
#

Ok I stop with the super reactions a_uSA_pepe_busy

woven solar
naive stone
woven solar
naive stone
#

i can see how vx=1 is valid, if you started with px=1. I don't understand what px you could use for vx=-2. And i'm still not understanding how you determined these velocities

#

oh px=6 i guess, for vx=-2

naive stone
woven solar
#

yeah, negative relative velocities mean the rock visits them in the opposite order

woven solar
naive stone
#

ok lets assume for a second that I understand. Is the problem then in a sense, to do this with multiple pairs of hailstones, and find a common valid velocity among them?

#

christmas is doomed

#

i'm struggling to use the logic above to even reason why the velocity given in the example is valid for 2 of the hailstones that share a velocity. with px=18, vx=-1 and px=12, vx=-1, they have a distance of 6. How do we then glean from that, that vx=-3 is a valid velocity to hit them both?

lime fulcrum
naive stone
#

fun problem, I liked that one

mossy basin
#

so the hailstones aren't moving relative to each other

#

and a rock hits one of them

#

in this frame of reference what velocity does that rock need to be to hit the other

#

if it hit at px=12 and it needs to hit at px=18 it can move at velocity one relative to hail, hitting 13, 14, 15, 16, 17, and 18 along the way

#

it can move at 2 velocity hitting, 14, 16, 18 along the way

#

it can move at 3 velocity hitting 15, 18

#

or it can move at 6 velocity going straight to 18

#

any other velocity and it misses the 2nd hailstone

naive stone
#

ok that much makes sense to me so far

mossy basin
#

once we have these velocities, we need to move back into the rocks frame of reference so we just subtract the shared velocity of the hailstones

#

from those possible velocities of the rock we just found

naive stone
#

so -1 - 1 == -2, -1 - 2 == -3 (the one we end up using?), -1 - 3 == -4, and -1 - 6 == -7 are the possible velocities if the rock only has to hit these two hailstones?

mossy basin
#

i think so

naive stone
#

heh

mossy basin
#

i think we need to reverse the signs, but lets say, 2, 3, 4, 7

 a          12 

 b          18 17 16
 rock @ 2   12 14 16

 b          18 19 20 21
 rock @ 3   12 15 18 21

 b          18 19 20
 rock @ 4   12 16 20

 b          18 19 
 rock @ 7   12 19 
naive stone
#

i'm confused what this is representing

mossy basin
#

sorry

#

lemme align it

#

this shows the position of b and the position of the rock a few nanoseconds after it hits a

#

up until they collide

sleek cave
#

part 2 looks super interesting

#

the math might be beyond me though lol

#

not sure if you need some ||linear algebra|| shenanigans, but i did just fine with part 1 with manual ||solving for systems of eqs||

#

now part 2 does ||amp it up to 3D||, so probably gonna have to bring in ||np.linalg.solve||

naive stone
#

oh ok i think i get it, so first line is the hailstone's movement, and the line after is the rock's simultaneous movement/position

mossy basin
#

yeah, the first case b is actually traveling backwards

naive stone
#

shouldn't it always travel backwards?

mossy basin
#

sorry, the other cases are traveling backwards, i forgot its -dx

#

we are hitting in the past

naive stone
#

oh

mossy basin
#

the solution, at least what i had, tries like all these sign combinations anyway

naive stone
#

i still am not sure how to get the other hailstones with different velocites involved though

mossy basin
#

i'm sure you can throw away some of them

#

we don't get the other hailstones involved

naive stone
#

but how can we narrow down to the correct velocity and use that velocity to then find the starting position?

sleek cave
#

oh i'm so confused

#

are time and position continous?

#

or do the stones have to collide at integer times (number of nanoseconds)

mossy basin
#

they collide at integer times, but this isn't specified in the problem because you're not solving for t anyway

sleek cave
#

kk i think part 2 might be beyond me

#

i'll do a first attempt, and unless miracle strikes, look for a hint :P

mossy basin
#

you don't even really have to look very long

naive stone
#

interesting

mossy basin
#

like if you get say 2, 3, 5 for a bunch just take the product

#

probably the velocity is 30

naive stone
#

and i'm assuming you can do this for each individual axis indepedently?

mossy basin
#

yep

#

once you have the velocities, the position is really easy to get

#

and the input makes it even easier

#

you can actually look up the position in your input in most cases

naive stone
#

that i can believe. I still don't feel very close to being able to write any code though, it's all very fuzzy still

mossy basin
#

yeah, i think this solution is kind of the messiest, but it's also in some sense the simplest

#

like, we're making very simple arguments to get the solution, but the code involves quite a few loops

#

but i guess less loops than gaussian elimination or whatever

naive stone
#

i wish i had time to actually work on it, but i have to clean the house first as i'm hosting christmas festivities later. Hopefully I can find some time inbetween

sleek cave
#

TIL about ||Z3||

#

how

#

does such a thing even exist

#

i'm accessing technology beyond my comprehension

#

this feels like dall.e all over again

#

i remember how awestruck i was

rapid wolf
#

It's a bunch of very interesting math, you can DIY your own and though it will be slower, it will work.

finite musk
#

guys I'm on day 10 rn do you guys think I can catch up to day 25 in 5 hours?

simple raven
#

you can with a couple ctrl+C, ctrl+V πŸ™‚

finite musk
#

unless I'm backed to a corner

woven sable
#

what's ||Z3?||

rancid creek
# woven sable what's ||Z3?||

||pip install z3-solver|| make sure you get that and not ||z3|| which has a similar name, but has to do with amazon s3.

woven sable
#

wait i feel like ive heard of that

#

is it similar to sympy?

finite musk
#

its like sympy but on steroids

woven sable
#

that's tuff

rancid creek
finite musk
#

day 5 wasn't easy but I didn't google anything to solve it

rancid creek
finite musk
#

the hardest day for me so far was day 10 part 2 at least with the approach I'm doing it (I refuse to bruteforce it)

woven sable
#

next year i'm making utils so i don't spend 1 hour on the same thing each time

#

day 12 was my breaking point lmao

rancid creek
#

there will be a couple problems similar to day 10 coming up.

finite musk
#

fuck I'll probably just take my time once aot ends

#

no reason to torture myself

#

I'll jump 25 like I did 23 and 24

#

I resisted jumping before because I was scared of the sudden jump in difficulty

#

but 23 and 24 (using z3) were both easier than problem 10 and 5

#

oh nice

#

fuck I gotta try 20 and 21 if they're the only real hardest

#

24 is kind of a cheat ||if you use z3||

rancid creek
#

here's a relative scale to give you an idea how the puzzles compare to each other I put together:

ripe meteor
#

What is this scale for ants

#

What happened to the big table

rancid creek
finite musk
#

goes along with what I've had personally

ripe meteor
rancid creek
finite musk
#

I don't know if I'd call day 23 hard, my non-optimized version of p2 took 4 minutes and that was just a classic ||dfs||

#

so it's only hard if you need an ||optimized version||

rancid creek
finite musk
candid berry
#

I wasted some time seeing if writing it in C++ would let a dumb approach succeed

#

still no, OOM killed πŸ™‚

finite musk
#

many less extreme problems and 0 insanes

finite musk
#

so there's some crazy optimizations to be made

candid berry
#

My final Python solution ran in just a few seconds, and it only took one pretty tiny change to get there.

finite musk
finite musk
#

||I'm too far behind in AOT to go that deep in optimizing though||

candid berry
rancid creek
candid berry
#

(like the number of people who knew about aoc)

#

today's was the only one I needed to use a spoiler for this year. And it was a small one - ||use z3||

finite musk
rancid creek
#

I had a little fun with my display code for day23.

candid berry
finite musk
#

I'm sure some people found an ||analytical solution|| which I'll try after I finish all prev questions

candid berry
#

the math required for a proper solution to today's is definitely past my depth

finite musk
#

here's mine

modern terrace
finite musk
#

we'll see

rancid creek
modern terrace
#

just didn't see the relevant wording

sleek cave
# woven sable what's ||Z3?||

it's a ||constraint solver. what that means is you can define a series of variables, set up constraints (in this case, equations) with them, and use z3 to get all possible values for those variables to satisfy these constraints. for hard yet "simple" problems like these, you can chug the problem statement directly into z3 and let it spit out an answer (thereby cheesing the problem).|| i don't like it bc it's basically cheating, but today's math was beyond my reach

lime fulcrum
#

ok I'd like a slight spoiler. what is part 2 of 22?

modern terrace
modern terrace
#

currently rn i have 256 possible combinations for the test input

#

978960 combinations for the real input

jovial jay
#

imagine for a exaggerated example, you have to solve P v NP problem in a day

sleek cave
#

i think ||Z3|| generalizes to any constraints though, not just mathematical and definitely not merely a system of linear equations

#

hence why you can cheese a lot of things with it

woven sable
#

ohh

candid berry
#

where's the line between cheesing and using the right tool for the job?

pine tiger
#

depends tbh

earnest forge
#

Merry Halloween everyone

#

if I can get 80th or better today I'll probably end up on overall global

#

that's a lot of pressure though lmao

minor cave
#

Language Roulette: Day 25 πŸŽ„
The language is ... Python bongochristmas

minor cave
#

Also yes, The Advent of Code Completionist Role will return. More details about that will be released in a few days. Merry Christmas & Happy Holidays y'allπŸŽ„

modern terrace
#

i still have no clue how to do d24 p2

#

i mean i have a start

magic oxide
#

literally

minor cave
magic oxide
#

oh wow where's the time gone

#

I should wake up before aoc starts

modern terrace
#

i have to do day 24 part 2 before day 25 releases

#

um

hexed axle
#

.xkcd 221

hidden copperBOT
#

RFC 1149.5 specifies 4 as the standard IEEE-vetted random number.

modern terrace
#

yeah i'll come back on this later

magic oxide
#

||use z3||

hexed axle
#

We're very fair here

magic oxide
#

||that's like probably the only way if you're doing p2 in 8 mins||

earnest forge
hidden musk
magic oxide
earnest forge
#

Anyway Merry Halloween and good luck to everyone

#

Here's hoping that I will be fast enough and enough people will be slow enough that I can get overall global LB

#

(I need like 80th to even have a shot)

#

((I wonder how many leaderboard people dropped off though, maybe non-zero given yesterday's p2))

#

GLHF everyone

covert arrow
#

Still skiing today

#

GLHF everyone t

#

Else

hollow wharf
shut trellisBOT
magic oxide
#

wtf

hollow wharf
#

looks easy tho

covert arrow
#

Looks alright tbh

modern terrace
#

huh-

#

how do i do this

covert arrow
#

Im reading the puzzle as I'm going up a chairlift

#

And my hands are freezing

#

But looks doable at a glance

plush peak
cold cove
#

does advent of code 2023 ends today?

hollow wharf
#

today is the last puzzle

#

for this year

pine tiger
#

done done done

#

||networkx|| saves the day

modern terrace
#

yeah i'm not sure how to do this

woven solar
#

yay, done. now, how do I solve d25 without cheating with my ||human eyes||?...

pine tiger
#

i mean this is just solving ||min cut||

#

man 3 classic problems in the past few days

#

damn

#

GOOOOOOOOOO

dim pivot
#

@pine tiger how do you do it without ||flows - I used networkx to compute this and got a decent place||

#

I'm 33rd - fine by me

pine tiger
dim pivot
#

oh

#

Seems weird

#

Because it's very hard for day 25 then

#

And very uncommon for AOC

pine tiger
magic oxide
#

these past few days have felt more like knowledge checks than anything tbh

pine tiger
#

yeah, definitely.

#

i'm just the tiniest bit afraid that eric's started running out of ideas

magic oxide
#

i didn't know ||what a cutset/min cut was before this, so i had to do some googling||

woven solar
dim pivot
#

I tried to do this first

#

But it didn't draw for some reason

#

so I had to think again

woven solar
#

i've now solved it the proper way and realised it'd have actually been faster πŸ˜”

#

since it's ||literally a single networkx function call||.

pine tiger
#

ok but you don’t know ||which nodes are in different partitions||

minor cave
woven solar
earnest forge
#

Dang

pine tiger
#

idk i might just be dumb

#

my current solution ||runs through every pair and stops when there's 3||

woven solar
dim pivot
#

yeah

modern terrace
#

i still need to figure out how to narrow down d24 p2

magic oxide
#

can't say i've enjoyed this year as much as the others tbh

modern terrace
#

i did more autowriting this year than in the past few years

earnest forge
modern terrace
#

which i think is a great improvement

dim pivot
magic oxide
#

yeah

dim pivot
#

Like what were your favourites

#

Mine was definitely day 21

magic oxide
#

the rest felt like either knowledge checks or "figure out this cool thing about ur input"

dim pivot
#

But that's only because I didn't do the ||quadratic|| solution - I did it by hand

magic oxide
#

mine was day 23

dim pivot
#

I didn't like that one at all actually

magic oxide
#

followed by day 19 and then day 5

dim pivot
#

For part 1 there's a really fast way but it's not needed

earnest forge
#

D23 was kinda neat ig

dim pivot
#

For part 2 there's an optimisation that doesn't really help the time complexity but it speeds it up MASSIVELY somehow

#

and there's no other optimisation I think

magic oxide
#

i've known of the ||collapse the maze into a smaller graph so you can run dijkstra/other weighted graph algs on it|| thing for a while, but i'd never actually done it before so it was cool for me

earnest forge
#

I think my favourite puzzle was probably day 7 honestly

magic oxide
#

and i liked my ||dfs with backtracking||

#

day 19 and day 5 were just ||reminders that i should make some interval interface||

dim pivot
#

I liked day 19 a lot

pine tiger
#

i'm immediately prejudcied

#

towards any day that requires some assumptions about the input

dim pivot
#

My favouite was probably day 12 tbh

magic oxide
#

i had fun with day 15 but that's because i did a one liner

pine tiger
modern terrace
magic oxide
#

least favourite was day 8

mossy basin
cold cove
#

you guys even working on christmas? leave today's aoc for tomorrow πŸ’€

mossy basin
#

it's not even christmas yet

cold cove
#

its here, timezone matters*

mossy basin
#

but i get to take off my santa hat soon

magic oxide
mossy basin
#

i was thinking about writing a more specific version for numeric intervals

#

mind_the_gaps doesn't require numbers just the items need to have __lt__

#

but things like shifting an interval or mapping an interval can't really be done with non-numbers

magic oxide
#

i have esoteric tendencies so i'm hesitant to start contributing to stuff people actually use

cold cove
#

i dont understand but every aoc problem can be solved using regular expressions, would it be legal?

magic oxide
#

why wouldn't it be

mossy basin
#

you can solve however you want

cold cove
#

ah thats nice

earnest forge
#

Including by-hand if you want (people did that for upping the ante one year, I remember)

mossy basin
#

can solve with pencil and paper or quantum physics or whatever

earnest forge
#

There might be logistical issues with that second one but yeah

pine tiger
#

what's mind the gap

mossy basin
#

!pypi mind_the_gaps

marsh currentBOT
pine tiger
#

lmao there's no documentation

rancid creek
#

well it's been a trip and a half, have fun y'all.

earnest forge
#

The thing that bugs me about that is you're calling the intervals gaps when gaps are the absence of gaps Β¬.Β¬

mossy basin
earnest forge
#

Anyway aoc_helper also has range and multirange helpers for numeric intervals

mossy basin
#

range is a bad name

#

maybe Range?

earnest forge
#

(I was already shadowing range with a custom helper but I took the opportunity to make the helper better at the point where I realised interval arithmetic would be useful)

#

One of the most cool things it lets you do is for i in range(large_number_pasted_from_aoc) + 1 for 1-indexed loops

mossy basin
#

did you implement sweep-line?

earnest forge
#

...no?

#

What's that lol

mossy basin
#

when you do some binary operation on a set of ranges you sweep-line to create the new set of ranges

pine tiger
earnest forge
mossy basin
earnest forge
#

I don't think I actually made that optimisation, but I do merge ranges where possible - range/multirange operations return a range if possible and a multirange if not lol

mossy basin
#

i had something similar, but now i always use a set of intervals instead of a single interval

woven oriole
#

in

#

||stoer wagner's algorithm , the motive is to find the edges with sum of min weight right , so here we plug weights = 1 i suppose ?||

finite musk
#

anybody else tried ||randomized search||

glad tartan
cyan sleet
#

also I guess roulette completed

hidden musk
#

leak the roulette making process fr

#

roulette people should get a clown emoji as the thing instead of the πŸŽ„

cyan sleet
#

a roulette enjoyer role would be fun

hidden musk
#

"enjoyer"

#

yk it actually made a lot of the early days more fun

#

but also roulette is a bit of a misnomer. more like rigged 😑

feral hazel
#

i made it :D
had to paste my code onto dpaste then reshare as a file it onto discord to run it on a code bot but i made it

hidden musk
#

huh. can't install python locally?

feral hazel
#

did the last two days on a phone

#

day 24 p2 was especially fun

cyan sleet
sleek cave
#

day 25, ||minimum cut problem?!?!?!||

#

though ||this graph is undirected||

#

and we also know it's just ||three cuts||

woven solar
#

it's as simple as it looks, yes

sleek cave
#

heck, i wonder if ||with the number of edges i can just O(E^3)|| it

hidden musk
#

there are at least 1000 edges, so probably not

sleek cave
#

sad

#

so i do have to brush up on ||graph theory||

woven solar
#

sure, if you want to write the algorithm for this yourself

#

i've seen some very interesting ||approximate|| solutions, but most people either used a library or implemented a proper ||min-cut-max-flow|| algo

dim pivot
#

There's an easier way to do it involving ||visualising the graph|| @sleek cave

#

You can use ||the algorithm of your brain and eyes||

jovial jay
vale fossil
#

DIGITAL LOGIC SIM is the best game fr

desert totem
#

@woven solar where did you guys learn all these algorithms?

jovial imp
#

go yt and bookds

torn schooner
#

Print(β€œMerry Christmas!”)

dry solstice
glad tartan
marsh currentBOT
#

aoctk/aoctk/data.py lines 305 to 306

def __matmul__(self, other) -> float:
    return sum(a * b for a, b in zip(self._c, other._c))```
dry solstice
#

That's pretty cool! How does it know that @ -> __matmul__?

#

Don't you have to write it somewhere for it to be recognized? I thought you needed tokenize for something like this

thorn inlet
#

its an operator just like +

dry solstice
thorn inlet
#

!e

class T:
  def __matmul__(self, other):
    return 42
print(T() @ None)
marsh currentBOT
#

@thorn inlet :white_check_mark: Your 3.12 eval job has completed with return code 0.

42
thorn inlet
dry solstice
halcyon pulsar
#

Does anyone have an image showing the difficulty rating for each day of aoc?

lusty rover
#

Based on what?

halcyon pulsar
#

Perhaps difficulty of previous years? I saw one posted a week ago that was every day up to the 16th

#

Categorised by easy, medium, hard, extreme, insane

lusty rover
#

Oh that's neat

lusty rover
halcyon pulsar
#

For day 13 would someone mind runnng their solution on my input and giving me a list of the value for each segment? My code works for the test but not for the whole thing and I can't spot the issue

#

||```py
def check_row(section: list[str], i: int) -> bool:
m = i
n = i + 1

while m >= 0 and n < len(section):
    if section[m] != section[n]:
        return False
    m -= 1
    n += 1
return True

def get_value(section: list[str]) -> int:
# Rows first
for i in range(len(section)):
if i + 1 != len(section) and check_row(section, i):
print("Row", i + 1)
return 100 * (i + 1)

# Columns
columns = [[] for _ in range(len(section[0]))]

for i in range(len(section)):
    for j in range(len(section[0])):
        columns[j].append(section[i][j])

for i in range(len(columns)):
    if columns[i] == columns[i + 1]:
        print("Column", i + 1)
        return i + 1

def part_one(data=data):
total = 0
for section in data:
total += get_value(section)
return total

halcyon pulsar
pine tiger
#

put your input in a pastebin here i suppose

sleek cave
#

TIL about ||randomized algorithms via karger's algo||

#

pretty cool to know that bogosort is sometimes a viable solution :P

#

time to implement it 😩

rancid creek
noble skiff
#

nice

#

so I'm not wrong in thinking 2020 was an easy year πŸ˜›

#

that's the only year I've gotten all 50 so far

#

I'm so close this year, I may try to get it. 23 seems pretty reasonable; so it's just that, figuring out two bugs in earlier part 2's, and the real issue will likely be day 24

#

an interesting question might be; in the context of AoC, are there really situations where this metric (leaderboard times) significantly depart from "difficulty" - i.e. questions where they take longer to do, but aren't "harder" in the sense that the completion rate of people who stick with them might be higher

#

it's quite possible there isn't any substantial departure (and if you thought there was, what would be a good, i.e. objective way, to make the case)

rancid creek
noble skiff
#

yeah

rancid creek
#

2020 day 20 was challenging.

rancid creek
#

With the caveat that if a puzzle hits something you have some expertise in you'd going to do better than usual. πŸ™‚

noble skiff
#

Yeah, looking back a bit at my solution, I personally think it was more grindy than anything else

#

you didn't really need to know, actually almost anything in particular; there's no graph traversal trick, no CRT, no shoelace...

#

If you take the fairly obvious heuristic for trying to combine edges, that heuristic was (IIRC) completely sufficient to actually solve the map

pure dove
#

was there a clever solution for day 24 part 2? ive finally finished everything and day 24 part 2 was the last one i got only because i left my thing running overnight and thankfully it terminated with the right answer by the time I woke up 😭

rancid creek
#

There was a couple other methods available that were likley more work

#

but ultimately it was ||figure out the math, find a way to solve it using linear algebra or using a lib to solve it||

rancid creek
pure dove
rancid creek
# pure dove chist ok, i took out my notebook and tried but i just could not in the end

dunno if you've been around to pick up my schtick: but I like to solve problems with very very terse code, but readable terse code, so not golfing, just terse.
I have around 800ish lines of experiments trying different things for day 24 part 2. and my eventual solution with ||z3||is about 8-10 lines. Possible could have been even more succinct if I knew ||z3|| better. πŸ™‚

#

I also have a lot of code for part 1, After I solved it I went back and learned ||shapely|| to solve part 1 again. That was fun!

pure dove
#

I too have on the order of 900 lines of commented out experimentation code for d24p2 :P

#

I ended up going with one of my first attempts anyway cuz I just couldn't figure it out on my own otherwise (and I really didn't want to ||use a solver like z3/sympy||)

#

my (i thought at the time) half-decent insight was that ||although none of the lines currently intersect, if the velocities are offset by the velocity of the rock then all the lines would intersect at the starting point|| but after that I ran out of bright ideas so ||I just brute forced outwards from offsets starting at (0, 0, 0)||

noble skiff
#

arg, 23 part 2, pass the test input but not the real one... πŸ˜‚

pure dove
#

rip

rancid creek
noble skiff
#

the end, but I passed part 1

#

my solution for part 2 was a copy paste of my part 1 solution with minor modifications

#

i'm getting some kind of infinite loop, so I guess there's something incorrect around the logic for keeping track of points I've already been to

rancid creek
noble skiff
rancid creek
rancid creek
#

did you uh, do anything to ||remove nodes from the maze|| ? <-- major spoiler so don't click if you're not ready

noble skiff
#

It's very simple so I'm super confused how it could go wrong.

noble skiff
rancid creek
noble skiff
#

I considered that approach, but I didn't ||remove in the end, but if there's only one branch I just proceed down it directly||

#

My p1 was very fast so I thought that was good enough

#

I guess it's possible that it's not an infinite loop at all, and it's just slow

noble skiff
#

Alright

#

What does that tell me?

jovial jay
#

advent of code is finished?

#

yeah looks to be done

zinc kindle
#

Doing day24 part2, want clarification: ||do the collision times need to be integers? Or is it possible for the rock to hit a hailstone e.g. 2.5 nanoseconds after being thrown? Assuming they don't need to be integers, hoping they do.||

modern terrace
zinc kindle
frigid ether
#

I noticed that in the summer there were some weekly challenges based on AoC here on this Discord server.
But I forgot how they were called and where to find them.
Does anyone know?

frigid ether
hollow wharf
#

is there a limited time to get 50 stars?

#

cause days 22 to 24 killed me and i need some time to do them

hidden musk
#

no

runic isle
#

Is there code challenges like this that you can do year round?

#

I know about codewars

ripe meteor
#

Codewars is not even in the same league as advent of code

#

There are other years you can practice on

rancid creek
runic isle
#

Thats true

#

I need to learn git and make a repo with all my solutions

#

Ive been trying to learn vim but gave up

rancid creek
runic isle
#

I think i ought to stick with something super simple like atom for now and just focus on going through a python book like crash course or automate the boring stuff

rancid creek
#

codewars will be a fine place to just practice simple things. if you did codewars adventofcode this year make sure you review others' solutions and look for new techniques or libraries to play with.

#

oh and probably not take any xelf solutions on codwars too seriously. more meme than best practice.

rancid creek
runic isle
#

Sure why not?

noble skiff
#

i thought it was kind of dead; had its lunch taken by vscode

cyan sleet
#

it's kinda dead yeah

noble skiff
runic isle
#

What does that mean?

noble skiff
#

i guess according to this it's... a bit ahead of emacs πŸ˜›

cyan sleet
#

there is some community fork after github stopped development on it

#

iirc

noble skiff
#

It means that the community is a lot smaller, there's fewer people who are likely to have written a guide explaining how to do something you want, fewer people who will have written a plugin for it

runic isle
#

Ah i see

noble skiff
#

fewer people who will be maintaining a language server for it, for some language you want

#

etc

#

it's also kind of, unclear, I guess, why one would use atom over vscode because... they're really exactly the same idea.

runic isle
#

Well theres always vim

noble skiff
#

emacs is niche yes but it's doing something totally different from vscode, in some ways. same with vim.

runic isle
#

Vscode is hard on my laptop

cyan sleet
#

vim is ever present

#

ever watching

noble skiff
#

i'd be surprised if atom solves that issue tbh. In any case what' smostly bad isn't the GUI/editor itself, it's the language server stuff

cyan sleet
#

the bad about the editor is that it's ||not vim||

noble skiff
#

lol

runic isle
#

Whats the best way to actually get good at vim?

noble skiff
#

with vim emulation you get the good parts of vim without the bad parts (everything else)

#

just keep using it; like anything else really. Mix in some occasional reading of blog posts with tips/tricks.

rapid wolf
#

mostly just force yourself to use it and you will find your brain figures it out

#

just do read ocasionaly so you don't end up like me, having to learn to use I and A about 2 years too late

noble skiff
#

just keep in mind that some vim stuff just isn't really as worth knowing anymore, to teh same degree it was before

#

and also really, in the end these are all pretty small optimizations in the grand scheme of things

runic isle
#

Got it

cyan sleet
#

that's where most of the vim magic is at

#

and in connection to that, learning the automation powers of vim like macros, global commands, etc 🀀

noble skiff
cyan sleet
#

how so? pithink

noble skiff
#

If you already know it I'm sure you get occasional opportunities to use it but I think it's mostly superceded by other stuff

cyan sleet
#

it's the part that actually makes it a power tool

noble skiff
#

That's not what I find. I also find that term a bit cringey tbh

cyan sleet
#

what superseded stuff like "execute this action on all lines matching this pattern"?

noble skiff
#

I don't really find it's something I ever need to do. In the past people would sort of try to make these things work for refactoring, but nowadays language-aware refactoring just works much better and it's easier to use

cyan sleet
#

I've had to do a lot of "do some processing of text in this semi-structured format"

noble skiff
#

it kidn of becomes more difficult to talk about once you move the conversation to things like that, as then a whole bunch of other things enter the picture

cyan sleet
#

macros and other automation is a godsend to avoid repeating the same processing of like 100 elements

noble skiff
#

I'm thinking mostly of actually editing code in this particular discussion

cyan sleet
#

ok, more reasonable scenario then:
I have this semi structured data and I want to do some processing to make it into a python list/dict for use in my program

noble skiff
#

i would probably just parse the whole thing with python

#

when I've had semi structured data it's far, far too large of a quantity that trying to munge files with vim would make any sense

cyan sleet
#

100s to 1000s of lines is in the sensible range with just some vim automation

noble skiff
#

but yeah, I mean, it's not hard for me to believe that there's some fairly specific scenario where vim allows you to save a handful of seconds with some clever /g commands or whatever.
I just dont' think these are tasks that most programmers are doing regularly; and usually when people want to have editor discussions I feel like it's pretty focused on code

cyan sleet
#

it's not always about being faster

noble skiff
#

uh ok πŸ™‚

cyan sleet
#

it's often about being less annoying and often less error-prone

rapid wolf
#

I have never needed anything more complicated than a series of :%s/. Sure, could probably :norm my way into a couple fewer keystrokes, but vim is god-awful at making these operations introspectable, so it's IMO just not worth it.

noble skiff
#

yeah. the ergonomics on macros/repeated commands is pretty terrible, for typical tasks, compared to multiple cursors

cyan sleet
noble skiff
#

I mean, sure, yes, but like... it's weird to use that as an argument for vim because that's ultimatelys till pretty manual, and it doesn't scale

rapid wolf
#

that's not unique to vim, 99% of what you need you can do with search and replace.

#

or multiple cursors

noble skiff
#

the actual thing to do, and what you'd undoubtedly do if you had more data, is write something to parse the semi-structured data as best possible

#

I've written python scripts to parse messy data dozens and dozens of times in my life, I've had a situation where the amount of data was in this rather narrow sweet spot for vim, just about never I think

cyan sleet
#

I've had a bunch of recent tasks that just didn't lend themselves well to full automation

#

but automating some building blocks was helpful

noble skiff
#

my actual favorite vim feature probaby and one of the main reasons I keep coming back to vim emulation is text objects

#

Especially the add-on "argument" object, it's almost funny how useful it is

#

cia for days

rapid wolf
#

I would not consider the tiny slice of extra power over search-and-replace complicated vim gives you worth learning, especially since you are forced into writing all your steps into a single line that offers no syntax highlighting, introspection, etc.

noble skiff
#

^

#

I learned a lot of that stuff at some point when I was really into vim and had so few opportunities to use it that I just forgot

cyan sleet
noble skiff
#

idk, I just don't think most software developers do such tasks very often

#

maybe sysadmins do, or people in other roles

#

that's an awfully specific reason to recommend vim

cyan sleet
#

it's a specific case where the automation capabilities bridge the gap between purely manual edits and full on automation, but I end up using simpler versions of the same stuff a bunch in general editing

#

like recording a macro or defining some ad-hoc keybind for some edit I need to repeat

rapid wolf
#

honestly, my experience with vim macros has been miserable

#

It's the bare minimum you need to have macros and absolutely 0 extra UX

noble skiff
#

it's just like I mentioned, there's a lot more tools now that "push" out places where you would use macros

#

formatters, refactoring like e.g. renaming variables but even also changing argument order, etc

rapid wolf
#

one usecase is taking code from language A and adjusting it for language B

noble skiff
#

in the past it was common to have to do a bunch of this repetive work "by hand" so macros had more opportunities for use

rapid wolf
#

I find myself doing that every once in a while

noble skiff
#

yeah, it comes in handy very occasionally

cyan sleet
#

but yeah, improved overall tooling is nice

rapid wolf
#

But honestly, there are more productive things to do than learn which specific utterly opaque, undiscovrable, memmonic-free, sequences of keybinds will do the right thing.

noble skiff
#

yeah, pretty much that

rapid wolf
#

I started using vim to avoid modifier keys, since it hurt my hand to press them. It does moderaly poorly at that, beating everything else by a mile

noble skiff
#

vscode or an IDE will get you a lot more stuff that you use more often, with less effort

#

and will still have vim emulation (including macros)

rapid wolf
#

the more elaborate vim things do tend to be missing from these emulations

cyan sleet
#

yeah

rapid wolf
#

:norm not being in VSCvim has been an issue exactly twice for me

noble skiff
#

yeah, that's the thing, the emulators usually get the stuff you use 99% of the time anyway

cyan sleet
noble skiff
#

the remaining 1% just doesn't really matter

rapid wolf
#

those we all agree are useful

cyan sleet
#

but those are the main things you would use in a macro/keybind pithink

noble skiff
#

it's a lot nicer to get feedback while you're doing stuff

#

compared to a macro where it just pukes out the whole command

#

a lot of the macro experience is: you want to do something on N lines. you record yourself doing it on the first.

#

Then you run it on the next n-1

#

and you see subtle mistakes

#

you undo, re-record

#

etc

#

in a lot of cases it takes longer then just doing the thing manually

#

but in vscode, you can literally create N vim cursors, and use vim commands to edit all N lines simultaneously. And see what you're doing step by step.

#

It's just a vastly better experience.

cyan sleet
#

maybe I've just gotten used to the editing stuff where I know how generic I need to be for an edit to be generic enough

#

stuff like avoiding relative movements a lot of the time, going right 4 times on this row might really be "go to the next )"

noble skiff
#

sure, but you must admit that's easier to do when you can see what you're doing

#

i have no trouble believing you've adapted to it

cyan sleet
#

when I record my macro I can see what I'm doing, but sure I get that seeing the action applied on multiple lines as you go can be quite useful

#

iirc kakoune (and maybe also helix?) tries to make that flow be possible

#

but my muscle memory ends up fighting the new patterns in these editors that are subtly backwards vs vim at times πŸ₯΄

noble skiff
#

for sure, I mean, if it works for you, you've been doing it a long time, it would be silly to force yourself to switch. I just think you gotta be realistic that for someone who hasn't yet acquired that... it's probably not worth it when they can just use multiple cursors and have everything be dead simple

hidden musk
cyan sleet
#

#advent-of-vim

noble skiff
#

πŸ˜‚

mossy basin
#

i didn't follow this conversation, but i use multiple cursors in vs code all the time

rancid creek
mossy basin
#

also alt+ctrl+up/down and or just spamming ctrl+d

noble skiff
#

i used to use emacs via spacemacs, then clion, now I'm trying to switch to vscode at work, I already use it at home. vscode with vscode vim and vspacecode is really nice

zenith elbow
smoky ravine
#

e β”¬β”€β”¬γƒŽ( ΒΊ _ ΒΊγƒŽ)

thin blaze
#

No more event status for AoC? πŸ˜„

magic oxide
#

event status?

cyan sleet
#

where roles? :V

pine tiger
simple raven
noble skiff
#

seems like just obvious trolling

simple raven
noble skiff
#

Saying the parsing was harder than solving the problem throughout is kind of a giveaway

#

I understand different people can think different things are difficult but this opinion just fails basic plausibility for the later days of aoc

pine tiger
#

yeah it's probably trolling

strange zinc
#

this is his account details

#

I can give him some slack due to being grade 9: still young and maturing.

rancid creek
#

The comment I enjoyed was "I did all 25 solutions".

strange zinc
#

haha

#

it was a good read

rancid creek
#

Posts 0 lines of code on the day of each puzzle or in fact ever. Claims to have done 25 solutions. Misses how many puzzles there actually were.
Low effort troll. I'm not going to reply to them. πŸ™‚

strange zinc
rancid creek
#

Real programmers used 49. πŸ™‚

strange zinc
#

πŸ˜‰

#

lazy ones use only 1... python