« first day (3 days earlier)      last day (1135 days later) » 
00:00 - 18:0019:00 - 00:00

00:13
Trying to figure out if there's a more intelligent way of doing today's than just tracking all the boards and checking each round...
 
2 hours later…
02:20
@SaintWacko oh interesting... what did you come up with
@HuỳnhTrầnKhanh Nothing lol
I'm still working on it, but I'm just tracking the boards as numpy arrays
02:44
Finally completed part 2! Only took me 21 hours...
(I mean, I had to sleep but still)
03:07
Oh ffs
Protip
If you create a numpy array, wrap it in a list, and multiply it by a number x (in order to have an array containing x copies of the array), they're all the same object -.-
that's just python stuff in general..
usually a generator is made: [val for i in range(x)]
reference vs value woohoo
[x] * n will always just give n of the same copy
so if you make a matrix you have to do [[0] * x for _ in range(y)]
you can't mutate ints so it's fine to copy those with list multiplication
03:30
Wait wait wait...did y'all mutate the bingo boards when numbers were called? I just took a slice of the currently called numbers each time and checked if those formed a row/column on any of the boards
Okay, that was super fun
@Razetime Yeah, that's what I did once I realized what was happening lol
@hyper-neutrino And that's why I didn't even think about it being an issue lol
I usually just do that with strings or ints
@RedwolfPrograms What did your code look like for that?
Because that's clever and I like it
I used numpy to track the boards and did some fun numpy stuff
with open('input', 'r') as file:
    lines = file.read().split('\n\n')
    balls = lines.pop(0).split(',')
    boards = [np.array([l.split() for l in line.split('\n')]) for line in lines]
    marks = [np.zeros(shape=(5, 5)) for b in boards]
    total = 0
    for ball in balls:
        for idx, board in enumerate(boards):
            loc = np.argwhere(board == ball)
            if loc.size > 0:
                loc = loc[0]
                marks[idx][loc[0]][loc[1]] = 1
                if any(np.all(marks[idx], axis=0)) or any(np.all(marks[idx], axis=1)):
Whoa
basically if you do a = [x] * 2 then a[0] and a[1] are the same reference
@SaintWacko Something along the line of b.some(r => r.every(x => nums.slice(0, i).includes(x))) || b.some((_, k) => b.every(r => nums.slice(0, i).includes(r[k])))
if you do a[0].append(1), then that will mutate the value, which also modifies its other reference
(Actually that's exactly what it looked like minus the spaces)
03:33
if you do a[0] = somethingelse, then that will reassign a[0] to be a reference to a different thing
@RedwolfPrograms Yeah, I like that. That's the sort of thing I was trying (and failing) to think of
Bah, I keep sliding down the leaderboards because I'm stopping myself from doing the puzzles when they first drop at 11pm lol
Oh hey, same time zone as me
CST gang :p
Haha :D
Oh also, if anyone's interested, here's my repo for this year: github.com/SaintWacko/aoc2021
Part 2 was a pretty simple change. The biggest modification was changing how I looped so I could modify the list as I iterated over it
04:25
@RedwolfPrograms Oh, that's nice. I did maps
04:50
10m
So quiet
Is my clock off?
I'm here!
Cutting it a little close lol
nah i nearly forgot
Today's challenge: Launch the nuclear missiles aboard the submarine :p
Santa's nuclear arsenal is unmatched
the code block copier userscript is very nice but uh
it triggers when you click on the home page links
04:56
ಠ_ಠ
Haha yeah
I need to change it to middle click or something
           ~  ~ ~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   1 **
                       . .       .         ..''''   2 **
                                .     .   :         3 **
                         .    . .'    ....'         4 **
                              ..|\..''              500:03:09
(function(){
var countdown = document.getElementById("calendar-countdown");
if (!countdown) return;
var server_eta = 853;
var key = "2021-5-"+server_eta;
var now = Math.floor(new Date().getTime()/1000);
var target = server_eta + now;
lol
That's what it copies for me
At least it wasn't rick astley
04:58
2m
@emanresuA you say that like you're disappointed in music choices.
except i'll probably mute it again like i did yesterday
04:58
1:07
I should listen to caramelldansen while doing AoC
2
47s
39s
04:59
@RedwolfPrograms i approve
05:03
1/3
holy shit
damn, if i didn't make a really small copy-paste issue i might've actually gotten double first
You're already done?
yep
lol, first star leaderboard was me → betaveros → kevin
and second star was kevin → betaveros → me
how in the fuck am i getting 35 on the sample input
Ugh wrong twice
05:07
...oh
i'm supposed to actually filter out non-horizontal lines
didn't occur to me there were any
also explains why it was so slow
Wrong three times D:
@UnrelatedString oh rip
so you were like
filling the whole rectangular area?
Hmm, but works on sample input
I don't know why I'm wrong :(
ah doorknob's no longer 1st :c
What do you have?
05:13
6485, why?
The inputs are random
As in code? Maybe we can help debug each oother
@hyper-neutrino yep lol
(I have tio.run/##Zc/NioMwEAfwc/… where numbers is a list of lists of coordinates)
No...you cannot read my code lol
grid = grid.map(g => g.fill(0));

inputs.filt(i => i[0][0]==i[1][0]||i[0][1]==i[1][1]).map(i => i[0][0] == i[1][0] ? work.count_incl(...[i[0][1], i[1][1]].sort()).for(x => grid[i[0][0]][x]++) : work.count_incl(...[i[0][0], i[1][0]].sort()).for(x => grid[x][i[0][1]]++));
ayy 399/387
05:14
what the fuck
is that
what the fuck is that
sort instead of c_sort fml
@RedwolfPrograms Oh, yu're nt using vanilla js
601/618
First day where my leaderboard rank on part 2 was worse than part 1
05:17
wow
nice
this is actually my first improvement between stars this year
@TheFifthMarshal you mean first day i assume?
mm I do love it when my vyxal times out
how do you do the link hover text thing again
wait did i just get the braces backwards
yep
i really haven't been sharp this week
i regret being born
05:22
when your program is super fast on the example input but takes way longer than 60 seconds on the actual input
are you filling rectangles
just generating all points on the lines and counting how many repeat
a horrible idea but it works
just really slowly
Oh I'm not differentiating diagonals and anti-diagonals
probably different on the details but that is literally what i did and it was pretty performant
05:24
@UnrelatedString this is using a transpiled-then-interpreted language btw
My range function is bugged and can't go backwards
my solution is super scuffed. if i had used any foresight i could've solved p2 by deleting one if statement but alas i didn't and looped via filling rectangles for p1 and had to rewrite that whole part
the transpilation overhead shouldn't be affected by input size should it
@RedwolfPrograms It infinite loops
i'm just chatting here while I wait for the output to display
05:25
so it's effectively the same language unless there's some weirdly inefficient detail of how it transpiles
@hyper-neutrino Same here
oh wait it's probably that you're using lists
@UnrelatedString vyxal uses lazy evaluation
I just tacked an else on to the if statement and handled the diagonals separately
a lazy list is not faster for a sequential search
05:26
Finally done
I'm starting to suspect there's a bug somewhere in 2.6
I don't know how I did this so pporly
Is it hard or am I dum
i found it fairly easy once i actually read the inputs
Day       Time  Rank  Score       Time  Rank  Score
  5   00:14:49  1501      0   00:26:44  1677      0
05:27
@UnrelatedString How is it hard lol, you just split by \n, then split the lines by ->, then split by ,
ah okay the counting function is being a little silly
@RedwolfPrograms What language are you using?
no like the fact that there were non-horizontal lines in them
@RedwolfPrograms did...you mean to reply to yourself?
05:28
Wait, you did that as part of the input parsing?
@lyxal Yes, I was trying to indicate is was meant to be grouped with that
But you interrupted my monologue
Anyone brave enough to read my solution?
inputs.map(i => i[0][0] == i[1][0] ? work.count_incl(...[i[0][1], i[1][1]].c_sort()).for(x => grid[i[0][0]][x]++) : i[0][1] == i[1][1] ? work.count_incl(...[i[0][0], i[1][0]].c_sort()).for(x => grid[x][i[0][1]]++) : work.count_incl(0, Math.abs(i[0][0] - i[1][0])).for(x => grid[Math.min(i[0][0],i[1][0])+x][Math.sign(i[0][0]-i[1][0])==Math.sign(i[0][1]-i[1][1])?Math.min(i[0][1],i[1][1])+x:Math.max(i[0][1],i[1][1])-x]++));
(although funnily enough i'm on enough two days of finals brain that i actually wrote my input parsing right, went to copy the input, then on seeing commas immediately thought "oh fuck it's using commas as a decimal separator" and put a .replace(',','') in)
nice
also TIL in python you can loop through sys.stdin
wait what
neat
@RedwolfPrograms This is the worst thing I've ever written I think
05:30
i just iter(input,'') which is why it gets fucky when the input contains blank lines because then i just change it to iter(input,'e') and manually add the e to the end
that is so much nicer
yeah i'm definitely migrating to [*sys.stdin]
Not having a range function makes this one a lot harder
I should've been not-sussy and used a for loop
or actually [l for l in sys.stdin] since it's not like i'm writing this on the clock
ah that's why it's taking so long. It's trying to count things in a list of 113k items
open(0) doesn't need import
https://tio.run/##K6gsycjPM/7/Py2/SCFbITNPIb8gNU/DQNOKi7OgKDOvRCMHyM3W1Pz/PyM1JyefKz0/PyWpMpUrJz8HAA
looks like it's time to implement some wack form of memoisation in vyxal
05:34
Ugh...
or some way to build the list into a structure that makes search operations faster
Thank you, JS, for allocating me 1000 identical arrays that are linked so they all end up the same.
You did a .fill(Array(1000).fill(0))? :/
@emanresuA what
If you do ^^ they're all references to the same array
05:36
@RedwolfPrograms Yep
is this a well understood feature of js
@btnlq oh that's a really cool trick
@RedwolfPrograms so they're not allocated separately
(At least nto for me)
05:37
@UnrelatedString Nope, because it's being passed as an argument
or do you mean it allocates an array of 1000 references to the same array?
It's passing that single array literal by reference
oh that's what the outer .fill is
yeah that also happens in python if you try [[0]*1000]*1000 in python instead of [[0]*1000 for _ in range(1000)]
which i think caught me like twice last year even though it's pretty obvious behavior
05:39
I used a defaultdict instead of 2D arrays
Hmm, should range(10, 20, -1) be [20, 19, ..., 12, 11] or [19, 18, ..., 11, 10]?
@TheFifthMarshal i just used two sets
that would work too
Dammitt, wrong twice
i used a normal dict lol
defaultdict would be smarter
05:41
@RedwolfPrograms i think python's behavior of just nothing is reasonable there
Nah, I think it makes more sense to give negative numbers a use
because you're supposed to be going from the first argument to the second
Oops I didn't consider antediagonal lines
nonempty 10,20,-1 would only be reasonable if it's the same as 20,10
Which is [20, 19, ..., 12, 11]
05:43
i.e. if the second argument is less than the first it's implicitly reversed with a negative step
wait you already have that
@RedwolfPrograms Wait, in Python it's not?
yeah just do that
wait why did i say reversed
i took too long to figure out what to do with the points once i gottem
05:44
just would implicitly be a negative step
@RedwolfPrograms it is an empty list
or rather an empty generator
unless you're using python 2
then it's an empty list
range isn't a generator, it's a sequence
you can tell range isn't a generator because you can reuse it
compare that to this: tio.run/##K6gsycjPM/7/…
oh yeah
so it's an abstract but non-stateful iterable
but yeah, if your step is in the wrong direction python gives you an empty range
which IMO only makes sense
05:48
you start at start, end at end, and step by the step amount
@RedwolfPrograms Mine's... quite a lot more readable.
returning from end to start just doesn't make any sense
and you can't just like loop around at infinity cuz that isn't a thing so
My Python attempt ran into the issue of range returning an empty list unexpectedly at one point
mine is fairly scuffed
But first I neglected the possibility that diagonal lines could have x and y directions that are opposite sign
05:49
if you do want to have two-arg range go either way i'd advocate for three-arg rejecting backwards steps at least so if you specifically need to catch order issues you can throw in an explicit 1 step
p1, so you can see i had to do quite a bit of modification
@TheFifthMarshal Same
My P2 code extended of P1 by adding an else statement, which makes it less elegant but less different from P1
doesn't look like my vyxal program will finish for the actual input, so here's what I had: ` -> `/vE'÷=a;ƛvh≈[vtsƒṡnhh$M|vhsƒṡntt$MR];ÞfĊvt1>∑
My p2 code added two else if statements
05:50
my p2 was just one extra ifg
@lyxal ƒṡ is neat.
Yeah it turns out I shouldn't have tried to solve this one with a one liner
@emanresuA it's horribly slow in getting the counts of points lol
@UnrelatedString Well I mean it was my first instinct
And I've done it for most of the others
And there are few situations where writing out a for loop is faster
I didn't think this through enough at the start to consider that this would be one of those
05:52
      -------Part 1--------   --------Part 2--------
Day       Time  Rank  Score       Time   Rank  Score
  5   00:44:54  5994      0   00:50:56   4274      0
not bad i think
5021/3582
And it would've been faster if I hadn't created a grid with identical row
my biggest mistake has to be tryna plot all the point instead of grouping them
rip
i've always been of the opinion that when you're dealing with a bunch of points making an actual grid is the absolute last resort
05:54
@UnrelatedString What did yoou do then
@Razetime I did that, and it worked fine
I was gonna say "haha 2d array in BQN go brr" but it took forever
I dropped two spots on the private leaderboard because I did awful today :/
(Then again, JS is speed)
@emanresuA how many minutes did your program run
@emanresuA i just stuck tuples in two sets
05:55
≈0.01 minutes
Mine was instant
1000 by 1000 array
Mine wasn't quite instant but wasn't longer than a second.
Yeah, that's about what mine was
If I weren't on my potat laptop it'd have been instant
tuples and/or complex numbers in sets and/or dicts is pretty much always how i do 2d aoc stuff
hyper-neutrino@DESKTOP-7QPTL9J:/mnt/c/Users/hyper/Desktop/alex-liao/projects/aoc$ time aoc

real    0m0.002s
user    0m0.000s
sys     0m0.001s
12
19663
05:56
sometimes i then drag that out into a real grid later
Imagine writing your sol in a file lol
And not just spamming one liners in the console
^ Used console.
i have a command line utility that automatically runs my code on both my test and real input files and outputs the former in blue and the latter in white
this is cuz i kept wasting time copy-pasting the test and real inputs into my input file and swapping them around
last year i had a huge library but this year it literally just loads in my input for me to save a bit of time
05:57
how do you do that
and now that i've learned you can just do for line in open(0), it really isn't all that necessary anymore kekw
Imagine tryharding
@UnrelatedString wdym
like getting the input automatically
@emanresuA true
05:57
oh you mean just swapping between inputs
@UnrelatedString oh no i have to copy-paste it into test-input.txt and input.txt
but like
prefix.py loads all of STDIN into a variable
i know there's that rust thing for actually fetching the input automatically
alias aoc="cd /mnt/c/Users/hyper/Desktop/alex-liao/projects/aoc; cat prefix.py main.py > src.py; echo -n -e '\\033[94m'; python3 src.py < test-input.txt; echo -n -e '\\033[0m'; python3 src.py < input.txt"
So uh what does part 2 actually entail?
@UnrelatedString i considered that
but decided it wasn't worth the trouble
05:58
get there and find out :)
also i need to copy the test data anyway
@lyxal Counting 45° diagonals
@lyxal I removed a function from part1 and it worked perfectly for part 2
@emanresuA so diagonal overlaps too?
05:59
Yep, but only 45° ones
only 45 degree ones are given
i wouldn't characterize other angles as diagonal
My definition of diagonal is just "not horizontal or vertical"
06:25
you have the right definition
06:37
i just noticed there are 23k people who got star 1 but not 2 on day 3
heh
i saw "For now, only consider horizontal and vertical lines"
immediately knew something was up
 
4 hours later…
11:06
also is no one going to make the obvious joke that today's AoC was a bit sussy?
11:44
why was it
11:56
> vents
mfing submarines venting
 
2 hours later…
14:06
sussy baka
 
2 hours later…
15:48
This was not that obvious a joke
Very sus, only an impostor would think about venting
Oh nice, hyper-neutrino and Manish Kundu are on the leaderboards
I shall cheer for them without solving challenges myself like sports fans
Oh, nthistle's there too, I think that's a CGCCer
16:03
There we go, finished day 5
Ran into some trouble with numpy or it'd have been done sooner
Spent too much time in a python shell poking at to figure out what I was doing wrong lol
Wait, you need numpy for these?
I thought vanilla Python would be enough for at least the earlier problems
16:31
no i think they just want to use numpy
i've been using vanilla python this whole time with only minor workflow optimizations so clearly it works :P
Oh ok, good to know
17:21
Yeah, you could do it vanilla, numpy just adds some useful shortcuts
00:00 - 18:0019:00 - 00:00

« first day (3 days earlier)      last day (1135 days later) »