[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1734158981577422.png (1 KB, 437x562)
1 KB
1 KB PNG
ASCII trees edition

>Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. People use them as a speed contest, interview prep, company training, university coursework, practice problems, or to challenge each other.
https://adventofcode.com/

/g/ leaderboard join code:
796940-44255af5
anonymous-only leaderboard:
383378-dd1e2041

previous thread: >>103511653
>>
nice
>>
File: solve.png (656 KB, 4792x3452)
656 KB
656 KB PNG
idiomatic Rust solution
>>
>>103515183
is that both parts?
where you find tree?
>>
no waifu drawing this time?? :(
>>
>>103515186
yes
line 23
>>
File: Day 14-2.gif (467 KB, 404x412)
467 KB
467 KB GIF
>>
Got filtered on day one. Didn't even read the puzzle. The drama around AOC is more interesting than the puzzles themself.
>>
>>103515211
You just sit in the corner and watch other men solve puzzles?
>>
>>103515232
Some people fucking love science, I just fucking love other people solutions to AoC. No reason to even bother with my own. This isn't a metaphor for cuckoldry. That requires actually having a woman.
>>
someone post the part 2 answer to this please http://0x0.st/XFQI.txt
>>
>>103515248
7037
>>
File: file.png (43 KB, 1056x626)
43 KB
43 KB PNG
>taps on the sign
>thanks GPT4
>>
>>103515241
>have a puzzle
>wait for another man to solve it
>"i like to watch"
>"but im not a cuck"
>>
>>103515195
I am too stupid for it. how does that work?
>>
>>103515205
wait a second...
>>
>>103515300
I just find the time when no robot occupies the same position as another.
>>
>>103515248
9287
>>
>>103515312
ah is it that method. isee. ty
>>
why do LLM make codefags seethe soo much, being replaced by your creation must hurt HA!
>>
>>103515241
>This isn't a metaphor for cuckoldry.
This is a perfect metaphor for cuckoldry.
>>
>>103515325
It's like taking a self driving car out for a cruise.
>>
File: IMG_5490.jpg (48 KB, 271x351)
48 KB
48 KB JPG
I haven't been able to start AOC until today
Anyone doing it in iversonian languages?
I'm going to practice my J this year, haven't even seriously programming in almost ten years now but these languages have helped me before when I need to kluge a solution together
>>
>>103515325
okay buddy, how long will i have to wait until LLMs don't fail simple world model tests or counterfactual reasoning?
>>
>Part 1
>"What a fun puzzle time to put my gamedev knowledge to use."
>Part 2
>????????
wtf Eric?? not even an example???
>>
I feel sort of dirty for getting this problem with the big hint that you had to find a really small pattern. It probably could've been done with brute force and enough patience. I'll take the star I guess
>>
File: aoc24_14.png (352 KB, 718x2562)
352 KB
352 KB PNG
Fun puzzle

Also printf functions in Odin seem to have a bug where integers with "%4d" format are always padded with zeroes (this should only happen with "%04d")
>>
>>103515374
just enumerate all states, compress them, then look at the most compressed states
>>
>>103515374
>gamedev knowledge
can you think of anything less useful?
>>
>>103515379
It's on you if you read the thread before solving
>>
>>103515356
there are several anons doing BQN and Uiua
>>
>>103515390
Yeah I'm aware I have no one else to blame but myself lol
>>
>>103515374
>adding numbers is gamedev knowledge
No wonder it pays like shit.
>>
File: day14.png (107 KB, 1054x620)
107 KB
107 KB PNG
Ahhh what the fuck. Had to open today's thread for ideas since Eric couldn't just put an example in the problem.
>>
>>103514119
retard
https://github.com/github/dmca/blob/master/2024/12/2024-12-10-adventofcode.md
>>
>>103515512
retard
>to_claude.txt
>>
Reminder that if you couldn't come up with a way to pick out unusual arrangements of robots and had to come to this thread to find out exactly what you're looking for, you're filtered.
>>
how the fuck do you solve day 12 part 2.................................
>>
>>103515529
see >>103515382
>>
>>103515531
????
>>
>>103515529
just count down
p1 = perimeter = 4 * area, count down
p2 = sides = perimeter, count down
>>
>>103515541
???????????
>>
File: shc.gif (2.62 MB, 498x280)
2.62 MB
2.62 MB GIF
>2019 day 20 part 2
>>
>>103515546
to find the perimeter, count down from 4 * area
to find the sides, count down from the perimeter
>>
>>103515529
store position of fences in format: x,y,i, x and y are self-explanatory, i is the direction from which you register the fence (N,S,W,E)
group the positions of fences by their i
a side is one continous line of fences - just count the gaps between the lines
>>103515529
he meant day 12, which was the garden
>>
>>103515581
>just count the gaps between the lines
up or down?
>>
I'm going to do RISC ASM next year targeting PS2.
>>
>>103515588
>looking through 6.4k images
just sort by size
>>
>>103515232
The puzzle cuck.
>>
File: aoc-2024-day-14.png (26 KB, 948x991)
26 KB
26 KB PNG
best day so far. I am surprised LLMs managed to get part 1. I would expect the quadrant part to trip them up.
my thought process to finding tree:
>it will probably be symmetrical (wrong)
>printing and viewing boards manually
>start suspecting tree will be in a frame
>search for "******" in each row (bingo)
posting only part 1, because part 2 wasn't really about the code.
>>
the christmas tree on eyes edit i think wouldn't look good, especially with my editing skills, so I went with pigeon guy. The >>103512944 pic was also considered - that's for you to decide which one you want.
due to popular demand of 1 (one) person, redditbob is back for day 11.
As always I'm open for feedback
>>
>>103515642
huh, I just noticed I am writing out of bounds... welp, still worked.
>>
>>103515642
how is the tree not simetrical?
>>
>>103515679
there is some noise on the board other than just the tree
>>
ERIC YOU FUCKING NIGGER
at least define what a Christmas tree shape is so I don't have to think about using FUCKING AI to find it.

I solved part1 without any of the code I need for 2. I am seething so hard right now. It better happen in less than 100 seconds or I will lose my shit.
>>
>>103515693
>so I don't have to think about using FUCKING AI to find it.
Lol. I wonder if a Christmas Tree might have a straight line. Or a large number of bots in contact with each other.
>>
>>103515693
the most perseverant zoomer
>>
>>103515660
i love you calendar anon
>>
>>103515706
Yes, I was going to steal my captcha slider solver code and look for low disorder and pray that's good enough. I'm still pissed off though because it feels like some bullshit problem with a hard pure computational solve. This is just like desert machine and having to look at it from the outside.
>>
i simulated it with a high timescale until I saw a suspicious flash, then I paused and backtracked a few frames, fun puzzle today
>>
>>103515693
fucking nigger there is an obvious loop sizes for both x and y coordinates of column and row count respectively
look for minimum standard deviation of both x and y seperately and apply crt for the system of linear congruences
x=minstdev_x (mod columns)
x=minstdev_y (mod rows)
and x is your solution
fucking nigger, AI my ass
braindead zoomer
>>
>>103515660
thanks for your efforts
>>
>>103515741
literal retard babble. an AI classifier is objectively the only good answer.

have a (You) though because you're just an Eric apologist dipshit. I already solved it.
>>
File: file.jpg (69 KB, 640x595)
69 KB
69 KB JPG
>>103515741
>>
>>103515693
you have 2 eyes
>>
>>103515768
lmao, you must have been a drooling retard before you got all those fancy AI tools a couple years back. you still are, but at least now you can pretend to be smart.
>>
>>103515794
>I'm a retard
>a bloo bloo
I never mentioned an LLM once you dumb fucking nigger. Maybe you should spend more than 2 seconds reading instead of confidently claiming to solve a problem on heuristics that are functionally coincidental solves.
>>
>>103515768
It's obvious that the xmas tree will form when the robots are the closest to each other, they will form one big blob, which is the xmas tree.
If you didn't write that image classifier and didn't train on own data you're filtered btw.
>>
>>103515801
yes, I know. I used my captcha slider code. it was trivial to calculate image disorder.
I still think it's niggerlicious because I had to fudge some numbers and hoped it worked.
>>
>>103515798
I never mentioned LLMs either, retard. stop digging yourself into a deeper hole.
>>
>>103515809
>Eric Apologist on full damage control.
you objectively cannot solve the question of:
"um, does this look like a christmas tree?" for any general picture without some kind of object classifier, which is strictly "AI."

cope and seethe like a dumb retard gorilla nigger all you want, but it's the truth.
>>
>>103515806
And I described a possible method for computing the timestamp when the robots are the closest to each other.
So what's your issue? I think it was a perfectly valid and fun problem.
>>
>>103515814
lmao, you can't objectively solve it unless >>103515789
you zoomers would be helpless in the 90s, like little babies
>>
File: 588.jpg (125 KB, 1375x749)
125 KB
125 KB JPG
>>103515541
>>
>>103515834
You can print the 10 most probable grids. It's even almost impossible to design a puzzle where all the robots have constant velocities and they are closer together than an xmas tree when it's not one and also have an xmas tree state. 99% that the state we're searching for is the min std dev for both x and y. But again, you can print the top 10 if you insist, you can review them in a second, it wasn't a bad puzzle. Only brainlets viewed through all 10k states.
>>103515574
kek the troll is back at work
it's against the rules outside of /b/ thoughbeit
>>
>>103515814
the tree is a red herring, what you're actually supposed to do is figure out the initial state of the simulation and that state just so happen to line up in the shape of a tree. you don't literally need to look for a tree retard, although you can do that by simulating it like some anons have done.
>>
Haskell
Found the tree using visual inspection.
import Data.Array

solve1 (w,h) xs = safety (w,h) $ map (robot (w,h) 100) xs

safety (w,h) xs = q1 * q2 * q3 * q4
where q1 = length $ filter (\(x,y) -> x < w1 && y < h1) xs
q2 = length $ filter (\(x,y) -> x > w1 && y < h1) xs
q3 = length $ filter (\(x,y) -> x < w1 && y > h1) xs
q4 = length $ filter (\(x,y) -> x > w1 && y > h1) xs
w1 = w `div` 2
h1 = h `div` 2

robot (w,h) n ((px,py),(vx,vy)) = ((px + vx*n) `mod` w, (py + vy*n) `mod` h)

solve2 (w,h) xs = mapM (\i -> writeFile (show i ++ ".pbm") $ bitmap (w,h) $ map (robot (w,h) i) xs) [0..10_000]

bitmap (w,h) xs = "P1\n" ++ show h ++ " " ++ show w ++ "\n" ++ elems a
where a = listArray ((0,0),(w-1,h-1)) (repeat '0') // zip xs (repeat '1')

readRobot :: String -> ((Int,Int),(Int,Int))
readRobot xs = (pair x, pair y)
where pair ys = read $ "(" ++ drop 2 ys ++ ")"
[x,y] = words xs

main = do xs <- map readRobot . lines <$> readFile "input"
print $ solve1 (101,103) xs
solve2 (101,103) xs
>>
File: file.png (104 KB, 1600x464)
104 KB
104 KB PNG
Today was fun. Really enjoyed writing a small linear algebra library for this. Will probably keep adding to it and use it instead of glm.
>>
>>103515928
when I was making my own linear algebra lib, I used glm for testing as a reference. in the process, I found and fixed a couple of bugs in glm. in the end, I think the library itself was a waste of time, but at least glm is a little bit better now.
>>
File: aoc2024 day14.png (184 KB, 1032x1108)
184 KB
184 KB PNG
The one time I actually go through the trouble of thinking up a part 1 solution that doesn't simulate everything, part 2 forces me to throw it away and simulate anyway.
Just dumb luck that I decided to start by testing with 10 as the minimum contiguous length. I figured the tree would just be a single triangle with a trunk, so I expected the widest part to be at least 30. Not sure why I didn't check vertically instead.
>>
>>103515241
Mental cuckoldry is far worse than physical cuckoldry. Have some shame.
>>
>>103515660
fantastic calendar
>>
>>103515356
there is someone doing it on a gameboy advance
>>
>>103515660
ty for putting back 11. looks good so far.
>>
>>103515834
But it's not the 90s. You sound like your grandparents telling you you'd be helpless without a calculator. The future is now, old man.
>>
>>103516031
it's kinda lame that many of those puzzles rely on having fast 64-bit integers. seems just lazy. I would be really pissed if I decided to go with a retro platform.
>>
>>103516062
>no I'm so heckin pissed off that it's hard doing the way I choose to
>>
>>103516062
Adding 64bit from 32bit registers is easy.
ARM7 has an instruction for multiplying two 32bit registers and returning a 64bit result across two registers, and it is fairly easy to multiple a 64bit value by a 32bit one. 64bitx64bit hasn't come up yet and probably won't.
>>
>>103516050
I don't mind people whipping out a cannon to kill a fly, especially in an event like this. it just pisses me off people have access to all this tools and still keep bitching about the puzzles. some dudes in 1930s cracked enigma with a bunch of wires and pencils, and today a retard can't find a picture of a tree on his screen with a 32-core 5GHz CPU.
>>
>>103516101
>some dudes in 1930s cracked enigma
god I hate that faggot so fucking much, he spoiled the plan to purge evil from earth
>>
File: file.png (4 KB, 101x195)
4 KB
4 KB PNG
What is this supposed to be, Eric, a Festivus tree?
>>
Does advent of code have any problems that would help me understand things like class or the difference between all these pointers ->, ob.a, etc
>>
>>103516116
you have fucked up the wrapping
>>
>>103516116
post your code so i can say
>what's this supposed to be, nigger, a solution?
>>
>>103516101
But why does it piss you off? In the 1930s, the ancestors of the people you're are complaining about were either illiterate farmers or semi-literate factory workers. It's not their fault that retards are forced into "coding" to feed the economy.
>>
>>103516125
It gave me the correct answer so I obviously did the wrapping correctly, I just have no clue why my particular answer is so noisy. Probably just messed up the rendering somehow
>>
>>103516121
No. But a data structure book will.
>>
>>103516116
post solution. I'll run it and render it on mine.
>>
>>103516198
I mean post input, not solution.
>>
>too high
give me an edge case, quick
>>
>>103516213
an edge case is that it can form hannukah candles too, you might be detecting that
>>
>>103516209
https://pastebin.com/Jkd2HAme
>>
>>103516050
real engineers always use calculators
>>
>>103516230
I specifically compiled my code with
-fno-oy-vey
so this should work
>>
>>103516244
looks good to me chief.
is your term emu fucked? are you using "wide characters" or anything outside of ascii?

I use @ for rendering.
>>
File: aoc.png (19 KB, 967x490)
19 KB
19 KB PNG
we're entering the pain zone
>>
>>103516288
Good. I hated p2, but if it filters LLMs, bring more on.
>>
>>103516159
it doesn't need to be a tree, it just needs to be a weighed lump of goop at a particular time stamp which catches your attention
>>
>>103515381
>Zero-is-initialization language has accidental zero
I wonder how that's happening
>>103515356
two BQN posters since day 1
third that picked it up during but only posts really bad code (me)
1-2 consistent APL posters
1 uiua poster
no J or K at all.
Iversonian code gets washed and reposted more often, increasing the visibility
I did a bit of J in past years but only pull it up for quick base/antibase and math/uu questions.
>>
>>103516264
I just used # and . for rendering, so I don't think it's a weird ascii bug. I can only guess I'm somehow not rendering every part of the tree correctly or something. Either I fucked that part up or I managed to fuck my algorithm up so creatively I accidentally got it to spit out the right answer
>>
File: day14_swift.png (541 KB, 2048x2160)
541 KB
541 KB PNG
>Swift doesn't have a true modulo operator

The absolute state of this meme language
>>
>>103516353
just integer divide, multiply back and subtract
>>
File: Festivus_Pole.jpg (23 KB, 457x870)
23 KB
23 KB JPG
>>103516116
>Festivus tree
That doesn't look anything like an aluminum pole.
>>
>>103516347
happened last thread too: >>103513940
and the error was some dodgy erasure of the last array position of a robot (when robots stack): >>103514142
>>
>>103515420
>length(bots) == length(set(bots))
what the fuck thats genius. how did you guys come up with that?
>>
>>103516434
That's not genius, it's called basic programming knowledge.
>>
idiomatic solution

import zlib

let bots = slurp().lines().map(&matches(/-?\d+/) |> &map(int))
let grid = %{*:[]}

for [x, y, vx, vy] in bots {
grid[(x, y)].push((vx, vy))
}

let (W, H) = (101, 103)

function show(grid) {
let char-grid = [[grid[(x, y)] ? '*' : ' ' for x in ..W] for y in ..W]
return char-grid.map(&str).unlines()
}

let min = 999999999

for k in (1..) {
let new-grid = %{*:[]}
for (i, j), bots in grid {
for (vx, vy) in bots {
new-grid[((i + vx + W) % W, (j + vy + H) % H)].push((vx, vy))
}
}

grid = new-grid

let b = zlib.compress(show(grid))
if #b < min {
min = #b
print(show(grid))
print(k, #b)
}
}
>>
>>103516471
>zlib.compress
based
>>
>>103516448
I was told I would learn programming from doing AoC.
>>
>>103516448
sigh. not the code. I mean knowing the picture uses all points and not overlapping any? I mean it makes sense eric wouldn't overlap any for the pic I guess
>>
>>103516481
occam's razor
>>
How did my fellow anons identify the tree? I counted the number of directly neighboring robots, and the image had 532 while most configurations barely reached 100. Second highest was only 128.
>>
>>103516121
-> is used to get a property from a pointer to a struct
. is used to get a property from a struct
these are equivalent:
struct a *p = malloc(sizeof(*tmp));
struct a x = *p;

p->b = 123;
x.b = 123;
>>
>>103516481
Not knowing, but rather guessing. It could be possible that in some earlier thate the same held, or that eric didn't make the "starting" state that way.
What I did was to look for long vertical lines and placed 332.
>>
>>103516492
fucked up the malloc, should be:
struct a *p = malloc(sizeof(*p));
>>
>>103516387
I can only guess it's some weird shit involving careless conversions between int32 and int64 which I was doing for some reason. The "check for overlapping robots" solution also didn't work for me so it might be a subtle correctness bug with how I'm handling wrapping. I'll just take the star and move on lmao
>>
>>103516499
sizeof is not a function. do you also write
return(*p)

?
>>
Part 1 in iogii, 76 bytes
};0g$2g100*+101%;51<50<2y>;1g3g100*+103
%;52<51<3 0y5y*;10=#>;5=#>;6=#>3=#***
>>
>>103516490
I looked for high numbers of matching xs'/ys which still saw a lot of noise but also the tree, and ran in reasonable time even with a 200ms sleep after prints.
after washing I look for 8x adjacent robots on a horizontal line and it prints the tree without noise.
other fun options are
1. print everything, with with video seeking to rewind and spot the tree
2. write everything to an image file named after the step and look at the thumbnails in a file/image browser. If you want to do this, PPM is easy: https://raytracing.github.io/books/RayTracingInOneWeekend.html
>>
>>103516508
sizeof needs the parentheses for types, so people just use them instead of trying to remember which way around the rule applies
>>
File: screenshot.png (141 KB, 675x563)
141 KB
141 KB PNG
>>103516490
>How did my fellow anons identify the tree?
with my eyes
>>
>>103516490
I built an animation and stared at the falling snow for a few minutes until I saw it.
>>
>>103516542
based
>>
>>103516490
I rendered out to a PNG and then passed to a visual classifier "Is this a tree?"
(not really, but someone should do this)
>>
File: yahoo.webm (1.61 MB, 412x352)
1.61 MB
1.61 MB WEBM
>>103515171
>>
File: day14 solution.png (431 KB, 980x944)
431 KB
431 KB PNG
>>103516490
I don't know what the intended solution was, but I just generated a bunch of images for each state and looked through the thumbnails. It turns out that the resulting image for the christmas tree has a much smaller filesize than the others, because the image is less random so it is presumably easier to compress. So to find the christmas tree you could also just sort the resulting folder by filesize.

I also noticed that the robots tend to vaguely band together in a horizontal and vertical line every (n*x+a) and (m*y+b) seconds, where x & y are the dimensions of the room and a & b are some other constants. So I assume the intended solution would be to just search the images for different values of n & m.
>>
File: im-1734192284459.png (131 KB, 684x965)
131 KB
131 KB PNG
>>103516434
>>103516448
I didn't come up with that, I didn't see any reason to assume that the bots would need to be all unique when forming a picture. I solved it by just looking at the distance from the center as a cheap proxy for entropy of the "image", and after sampling a bunch of iterations, tried coding in a threshold for when to guess the image had formed.
excellent puzzle and part 2 was very original.
>>
>>103516530
Or easier:
1. Print 10-100k binary images as .png into a folder
2. sort that folder by size
3. the tree will always be the smaller one thanks to PNG's deflate algorithm
>>
>>103516387
>>103516504
Holy shit I just forgot to ensure I wasn't taking the modulus of a negative number lmao. PEBKAC
>>
>>103516701
hi tony!
>>
>>103516490
Guessed that there would be no overlapping robots, and the first result with no overlaps was correct.
Had that not worked I would've either done it manually, or this method >>103516471
>>
File: img-2024-12-14-17-15-00.png (226 KB, 1586x1192)
226 KB
226 KB PNG
optimized idiomatic Rust solution
1ms for input
374ms for the bigboy
>>
>>103516706
PEBKAC?
paranoid evil bolshevik kgb agent cniles?
>>
File: file.png (51 KB, 745x699)
51 KB
51 KB PNG
I wasted too much time looking for a symmetric grid... Looked for the grid with the most robots immediately next to each instead and it was the top result.
>>
>>103516751
problem exists between kwanzaa and christmas
>>
>>103516759
nice, i did a similar thing >>103516675
>>
>>103516701
kek amazing.
>>
>>103516762
thank god I'm not an amerimutt
>>
The improved bathroom security got me. I peed my pants.
>>
>>103516814
if you go to the bathroom before solving the problem you're filtered.
>>
>>103516830
Good, I hope you never visited the bathroom in your life, otherwise you will be filtered by precisely tomorrow at 6 AM.
In other words, you're a streetshitter. Please stay in india, you're not compatible with western civilization.
>>
>>103516854
>shoehorning india into /aocg/ with a strongly-worded and aggressively ESL post
i think it's a paki
>>
>>103516759
something similar to
>calculate maximum number of neighboring robots for each line
>if there exists a sequence of three lines with values decremeting by 2, that's it
can do the trick?

e.g line 50 has 19 robots in a row, line 49 has 17 robots in a row, line 48 has 16 robots in a row -> this looks like a tree, look it up
>>
File: 1703998394307171.png (69 KB, 613x761)
69 KB
69 KB PNG
when I saw it I shat bricks
>>
Part 1 in iogii, down to 68 bytes
};0g$2g100*+101%;51<50<2y>;1g3g100
*+103%;52<51<3 0y5y*:s:v?n:\1D#1+P
>>
You all missed the point, part 2 is literally an extension of part 1. When you divide an image into a grid you can find density hotspots (the tree)
>>
>>103516896
part1 in bukaki
LKJSf9048>?<"0p/53;ppvm()*fv';fgg:=
>>
>>103516972
why tree is in the exact center. the density is uniform
>>
Part 1 and 2 in aocscript, down to 4 bytes
2414
>>
File: 1722321569551143.png (11 KB, 973x967)
11 KB
11 KB PNG
>>103516891
and heres le tree
basically bruteforced it with enter waiting for input, realized theres a pattern to when the robots line up, and hardcoded it into the search so that I basically only had to skip like 60 pictures
yeah my solution wouldnt work for other inputs but does it even matter
>>103516972
visualizing the progression is unironically more fun
>>
File: file.png (537 KB, 1495x733)
537 KB
537 KB PNG
>>103516880
>>if there exists a sequence of three lines with values decremeting by 2, that's it
It would probably work but you wouldnt know how the tree looks before finding the answer to know this. Like how are you supposed to know that the tree leave lines decrement by 2 and not 4 for example? Either is viable. Eric didnt provide a reference image. I was thinking at first that the tree could be triangular, that didnt turn out to be true obviously..
>>
>>103516979
>24
anon the year operator is deprecated now you can just do 14
>>
>>103516972
just use the chinese remainder theorem, retard
>>
>>103516999
wow you are really smart
>>
>>103516530
Thanks for the link. Might be worth the read. Also didn't know PPM was that simple a format. Will use in future puzzles.
>>
>>103516999
>using anything chinese
fucking commie
>>
I'm looking at generated images and it all looks like a crt tv with broken hsync
>>
>>103516980
>basically bruteforced it with enter waiting for input
same. in the process I learned that once you redirect a file to stdin in shell (<), you can't use keyboard for input anymore.
>>
File: image (4).png (70 KB, 884x920)
70 KB
70 KB PNG
Ok, so maybe this isn't really a programmatic solution (not even for Mathematica), but I had no idea what he even meant by
>arrange themselves into the picture of a Christmas tree
And that after that trivial first part.
Maybe now I can think about how to do it for real.
>>
>>103517089
what is there to get? you have a bunch of particles in space and at some point in time they'll arrange themselves in the shape of a pine, find that point in time, which is whole seconds from the start of the simulation.
>>
File: warning.png (21 KB, 763x201)
21 KB
21 KB PNG
>>103515693
>>
>>103517098
I thought it'd be more like a big outline of a tree, so I looked for the highest number of same y-values in a cycle (9991 s for me). But the solution was only the 80th lowest in that set, because the picture was different than I thought. Now knowing that it's about clustered robots, it can be done much easier.
>>
>>103517149
>new reddit
kys
>>
>all these people seething about being filtered by a fucking tree
best problem so far
>>
File: JZ0Qf.jpg (283 KB, 1014x731)
283 KB
283 KB JPG
proposing this for thread/calendar image
>>
>>103516979
>>103516995
aocscript's cute and all, like hq9+ was, but the dev takes too long to update, sometimes longer than a whole day, and it's written in Rust: https://lib.rs/search?q=advent+of+code
>>
the first problem of the year where I actually wrote some comments in case I'll look up the code in the future
doesn't change the fact that it was easy
hopefully, when the wall hits, it hits HARD
>>
>>103517149
DaggerDragon is a power tripper. It's supposedly a she but I don't know if troon or not.
>>
>>103517294
eric's wife follows him on twitter
>>
>>103516880
I detected a period of x frames this way
I guess I'll just render all the frames from that set and look at them
>>
>>103516706
didn't I say you fucked up the wrapping? give me your star, now
>>
File: file.png (2 KB, 120x32)
2 KB
2 KB PNG
>>103517355
Come and take it
>>
>>103516891
how many fagflags does this have lmao
>>
>>103517372
how do you have 29?
>>
>>103517416
Eric handed out bonus stars yesterday >>103505506
>>
File: swiggity swooty.png (7 KB, 196x287)
7 KB
7 KB PNG
>>103517372
>>
>>103517391
idk if I've discovered all of them but there's an acearo flag that I've never had to use if you do both subscripted 1 (apply function to next on the stack)
idk why you'd ever need this but I imagine it just exists for completionism
havent found any gay/lesbian flags yet
>>
>>103517443
You would think after doing these for 10 years, you would have learned enough to actually complete a year all the way to the end.
>>
>>103517453
i cherrypick the ones I think look fun at a glance, sue me
>>
File: 1706772045995902.png (36 KB, 884x869)
36 KB
36 KB PNG
>>103517391
>>103517450
ofc thats ignoring the actual built in constants for the fag flags
let me guess, your language DOESNT have a built in array of pride flag images?
>>
My body is ready.
>>
>>103516490
For each 2 adjecent positions get the absolute difference between them and the length of it. Sum the differences up for each second and the minimum should be where the tree is.
>>
>>103517507
based
>>
>>103517503
lmfao
>>
>>103517503
These are the people who say "rent free" and "obsessed" btw
>>
>>103517523
rent free
>>
>>103517523
obsessed
>>
>wasted times looking at glitchy images because my rendering code was wrong
oh well, now I see the tree
>>
>>103517503
wait what language is this?
>>
File: 1719672005804497.png (351 KB, 881x604)
351 KB
351 KB PNG
>>103517523
erm what did trans people do to you chud
>>103517534
wee-wee
>>
>>103517540
I want to forcibly push my penis all the way down this slut's throat, if you know what I mean
>>
>>103517503
before March 2023, uiua's transpose operator was the trans flag. Not flag-colored like it is now: it was the exact unicode flag emoji. Look in git log -p for "Yes, the transpose"
before March 2024, uiua had Trans, Bi, Pan, Gay, Ace, Nb, Fluid, and Queer operators - but no Lesbian! The Lesbian flag was contributed by Qexat, whose only other commit is an adjustment to the gradient image for the flag.
uiua is not just gay, but also faking it.
>>
>>103517554
thats a man and youre gay
not even a tranny my lad
>>
>>103515276
>nocoder has mental disability aid write some goyslop code
>>
>>103517563
>lena
>man
>>
>>103517568
lena is the picture that image is parodying
the guy in the picture is martin
>>
>>103516490
I used convolution to search for a few hardcoded patterns
if scipy.ndimage.convolve(grid, tree, mode="constant", cval=0).max() == tree.sum():
printgrid(grid)
print(i)
>>
>>103517574
>the guy
that's lena, it literally says so in the image, retard
>>
>>103517579
bait used to be believable
>>
>>103517582
>this faggot wouldn't prime lena
faggot
>>
>>103517566
the cope is real
>>
File: xarbon.png (12 KB, 1132x356)
12 KB
12 KB PNG
White man's solution
>>
>>103517593
>xolatile
yikes
>>
>>103517593
having an ugly dev environment doesn't make your code run any faster, anon
>>
Today's part 2 is actual fucking bullshit. I have to find a "christmas tree". What the fuck does that mean? What does the christmas tree look like? Is it centered? How big is it? Is it filled? None of these questions were answered.
>>
>>103517600
Today's part 2 was absolute kino.
>>
>>103517597
I'm not him, seethe more
>>103517599
Why are you assuming my dev environment?
>>
>>103517600
Who doesn't know what a tree looks like? Have you never seen a Christmas tree before?
>>
>>103517609
>I'm not him
sure thing, xolatile
>>
>>103517600
that its bullshit is a big hint that it's easy. Make some guesses and do some exploratory programming. It's easy in your language, right?
>>
File: step7572.png (570 B, 101x103)
570 B
570 B PNG
Phew.
>>
>>103517600
t. LLM
>>
>>103517617
I made some guesses. They were wrong.
>>
>>103517624
Hi, LLM
>>
File: 1734199082339.jpg (41 KB, 1070x453)
41 KB
41 KB JPG
>>103517600
>>
>>103517600
>he doesn't know what a christmas tree is
kek
>>
>>103517605
>>103517610
>>103517624
>>103517664
Tyfyc
>>
>>103517609
>assuming
i'm not
>>
>>103517677
My dev environment is openSUSE, pypy and vim
How did you know?
>>
>>103517600
>write a function to generate every possible permutation of a christmas tree that fits a 101x103 grid
>iterate over the robots and simulate them N times where N is the number of permutations
>use the current permutation as a mask on the grid and check if there's a match
>scale each permutation down to fit each quadrant and check that too
>rotate each permutation too
>etc
it's easy
>>
>>103517689
your font and syntax poop smearing gave it away
>>
>>103517600
>Is it centered?
kek this is the thing that fucked me at first. I thought because in part 1 you don't use the middle so I tried a bunch of shit looking for positions down or across the middle. my tree was no where near the middle. rip
>>
>>103517724
retard
>>
>>103517600
This is actually one of the few good "hard" puzzles, since it relies on the programmer being creative rather than just autistically recalling a specific algorithm or formula.
>>
>>103517761
No it isn't
>>
File: aocp.png (2.93 MB, 9781x3115)
2.93 MB
2.93 MB PNG
aktualisierter Kalender
>>
File: 1727155320264271.jpg (57 KB, 470x600)
57 KB
57 KB JPG
>>103517582
>>
>>103515276
>widht
Pathetic.
>>
File: Day14-solve.png (500 KB, 1778x1099)
500 KB
500 KB PNG
>>
>>103517834
holy kek so true. Im a brootchad btw
>>
wish i had the time to join
miss the autism
where are the calendars?
>>
>>103517857
oh no, the rustard gonna post it again...
>>
>>103517803
Pretty sure more compact Python solutions have been posted for every problem
>>
>>103517902
I also try to be efficient, on day 6 and day 9 it made the solution longer.
They should make their own calendars too btw
>>
>>103517803
>>103517944
your code looks gay and your shit is all fucked
>>
File: idiomatic_calendar.png (3.56 MB, 9829x4128)
3.56 MB
3.56 MB PNG
official /aocg/ calendar
>>
>>103517987
>t. nocoder
>>
File: input_vis.mp4 (13 KB, 202x206)
13 KB
13 KB MP4
>>103517834
I literally just used Eric's crude measure of entropy (lots of bots in one quadrant) and just kept looking for new minimum entropy states.

Unoptimized awk code runs in about 10 seconds.
>>
>>103515312
>I just find the time when no robot occupies the same position as another.
there are two instances where that happens with my input. fuck you eric.
input = open('14.txt').read().strip().split('\n')
tall = 103
wide = 101

r = re.compile(r'-?\d+')
robots: list[list[int]] = []
for i in input:
robots.append(list(map(int, r.findall(i))))
for i in range(tall*wide):
s = set()
for [x, y, vx, vy] in robots:
s.add(((x+vx*i) % wide, (y+vy*i) % tall))
if len(s) == len(robots):
print(i)
>>
>>103518032
try using the variance >>103516750
>>
File: day14.png (372 KB, 1860x2712)
372 KB
372 KB PNG
Modern C++
>>
File: input_vis_slow.mp4 (38 KB, 202x206)
38 KB
38 KB MP4
>>103518024
fuck, wrong file
>>
>>103518073
Why is it considered modern C++ to shart auto everywhere? Or even more confusingly, put auto as the return type of the function, then put a type hint on the right?
>>
File: viz.webm (1.16 MB, 434x372)
1.16 MB
1.16 MB WEBM
updated visualisation
since I already know my input the lerping is easy but I thought about the idea of associating each robot with a mass and scaling time based on center of mass of the whole simulation.
>>
>>103518149
by using auto you can easily grep for the declaration of a variable without knowing its type
>>
>>103518149
grepping, alignment, and more readable
>>
>>103518149
The alternative is std::vector::shit::fuck::namespace:hell::garbage<std::macguffin, std::condom> foo = std::vector::shit::fuck::namespace:hell::garbage<std::macguffin, std::condom>();
>>
>>103518159
this is pretty satisfying, anon
thanks for sharing
i looped it like 4 times
>>
>>103518073
>Modern C++
Looks almost as horrid as Rust. Everything after C++98 was a mistake.
>>
File: carbon.png (282 KB, 2096x1666)
282 KB
282 KB PNG
I'm not even ashamed of this retarded solution
>>
>>103518159
i meant output, duh
>>
>>103518149
Modern C++ here, you can do derived types from the argument types, like:

auto f(auto arg) -> std::optional<decltype(arg)> {}

here the return type is an optional of the argument, and you would not have been able to do this if you had the return type on the left
>>
>>103518341
>and you would not have been able to do this if you had the return type on the left
That's an implementation and design issue. Any language with generics can handle this better.
>>
File: zig.png (1.16 MB, 1774x4177)
1.16 MB
1.16 MB PNG
belated long zig
compiled with ReleaseFast, my first redo in Zig was more than 13x slower than my BQN solution in >>103513998 . That Zig detected the tree drawing it to a string and looking for a line of stars in the string.
this version is just under 10x faster than the BQN, and detects the tree by compressing the coordinate space and looking for high collisions.
>>
>>103517600
t. retard
>>
>>103518426
If it was retarded, you would have engaged with my argument and shown how it was retarded, but you didn't. Curious. Methinks you might be retarded.
>>
>>103518385
but template metaprogramming is super powerful in c++
>>
>>103518450
retard - needs to be told exactly what to do and can't go off script
gigachad - takes vague instructions and uses his mind to complete them
>>
>>103518515
Once again, you do not engage with my argument. Thank you for your concession.
>>
>>103517600
spotted the heeb
2000 years later and still seething about christmas, i see
>>
>>103518515
An extremely disturbingly high amount of people seem to come here, read other peoples solutions, decide that they must have solved the problem by following a memorized "algorithm", find a name for it, implement it off of wikipedia, and then pretend they aren't filtered.
It makes me sick.

Most of my solutions aren't optimal. They have no name. why? Because they are my own.
>>
>>103518712
For an example. Look at how fast day 12 tunnel visioned onto "corner counting"
>but.... thats the solution
No, that is one of many solutions. you NIGGERS can't think for yourselves though. You were filtered if you had to come here and see that others corner counted.
>>
>>103517294
No authentic women is a reddit mod for a autist competition. All I know about that mod is that it’s a troon, and it become incensed when 4chan took a victory lap by posting a calendar image to reddit.
>>
>>103518712
>>103518745
Do you spend all December, every year, this upset?
>>
>>103518712
based
this is how i started out programming + aoc
but now that I learned a lot of the "standard" algorithms like bfs, dikjstras etc I tend to try to fit the problem to them first. i like the crazy ones where you have to come up with your own, like the side finding and the xmas tree
>>
File: tgf.png (838 KB, 2039x2117)
838 KB
838 KB PNG
>>
>>103518753
do you spend all december this filtered?
>>
>>103518760
>but now that I learned a lot of the "standard" algorithms like bfs, dikjstras etc I tend to try to fit the problem to them first. i like the crazy ones where you have to come up with your own, like the side finding and the xmas tree
Yeah it is the same for me. It's a lot less fun now once you instantly know the solution to the problem. I can't tell if the problems are getting easier, or if I am just learning the patterns.
>>
>>103516701
this is interesting. will it also work well on a tree that, instead of solid color, is line art and bigger? And without that square box around it?
I feel the randomness should still decrease measurably.
>>
>>103518712
memorised algorithms (dijkstra's, dfs, binary search, etc.) are standard tools
when i try to break problems into subproblems i'll hit walls that i have a standard solution to
e.g. how do i find which set this element is in? union/find data structure
>a disturbing number of people are applying these tools... i feel sick; i can't handle it...
just enjoy the fucking christmas puzzles, faggot
>>
>>103518745
the real solution was counting down, original, efficient. only one is known to have done it
>>
>>103518837
Sorry if I wasn't clear.
I didn't mean things like dfs, dijkstras, etc.
I mean't people saying "WTF HOW WAS I SUPPOSED TO MEMORIZE THIS CORNER COUNTING ALGORITHM" and "WTF HOW WAS I SUPPOSED TO KNOW HOW TO TAKE THE DETERMINANT OF A 2x2 MATRIX". When in fact these are just one particular solution to the problem, and they could have easily come up with their own solution if they weren't indian.
>>
>>103518861
fair enough, i think i understand
for the fence problem i counted the number of turns to follow the border
it was very inefficient, but it worked
>>
Is there any proof of sharing input.txts actually causing harm? Like someone actually trying to clone the AOC site? Or is this all made up in someone's head?
>>
>>103518879
I did this but couldnt figure out how to deal with the interior holes, so I had to pivot to reducing the set of all edges to a list of adjacent edges.
>>
>>103518712
I really only break out digging for optimized algorithms or whatever if I'm trying to optimize my solution to bring the runtime down or something. When actually solving the problem needing to have those things spoonfed to you kind of goes against the spirit of things
>>
>>103518899
I’m sure there’s a jeet AOC clone somewhere.
>>
>maximum bathroom security
>>
>>103518901
That’s smart though. You’re definitely not filtered if you solve it yourself, and then change your algorithm because someone else had a superior idea.
>>
>>103518901
yeah optimization is a completely different phase of AoC where you can learn from others solutions and learn new tricks and ways to think about the problem from other people.

but you MUST solve it yourself first. Simple as.
>>
>>103518748
Any woman sufficiently autistic to enjoy male spaces doesn't bring up that she's a woman because she knows it will RUIN the atmosphere.
>>
>>103516471
What language is this?
>>
>>103518900
i checked if each cell was at a border, and marked it as such
that included interior borders, so they were counted too
>>
>>103516490
I calculated the period of each robot (it's always 10403 i.e. 101 * 103) and then generated grids for each output, then dumped it into a text file. From there I just randomly searched ##### (guessing the leaves of the tree) and found it.
>>
for some reason my brain melts whenever I try to conceptualize things like crt, lcm, modular arithmetic.

lets say robot 1 has a velocity of 43 and robot 2 has a velocity of 67 on the 103 size grid (numbers pulled out of my ass).

For some reason my dumb ass cant intuitively come up with how to use modulos and remainders and factors and whatever to figure out when they sync up. Am I a lost cause 80 iq retard that will never make it?

And yes, I can fuck around with the numbers and retroactively give an explanation to why it works, but I can't intuitively think about these problems like I can for others.
>>
>>103519010
if you have trouble with something in maths why dont you study it
practice and drilling, even PHD mathematicians do bullshit problems to keep their mind sharp
>>
>>103519025
fair enough. I will be prepared for the crt problem this year (as long as its not tonight......)
>>
>>103519010
imagine this robot is a car. he's currently at 999987 and goes 15 forward
what will the odometer read?
>>
>>103518899
I kind of imagine it's just a Nintendo situation where they obviously can't go for every 12 year old kid who downloads a rom off a website, so they just have to make an example out of people in highly moderatable spaces
>>
>>103516783
>>103516751
Super DAU
>>
>>103519057
yeah I get you though
once I graduated from university I basically stopped practicing maths, took me embarassingly long to solve/simplify yesterday's equation
its a shame because at its core I love maths and it's most likely the field I'd have went with if programming wasn't even more fun, but not having problem shoved down my throat by school means I've just neglected doing them ever
>>
>>103519095
>once I graduated from university I basically stopped practicing maths,
Well, you can resume anytime. Just obtain books on subjects that interest you and keep going.
>>
>>103519078
I get basic modulo stuff. But as soon as i try to conceptualize CRT problems where there are multiple things with different remainders and 'speeds' and stuff all of my intuition evaporates somehow. Like an anon said earlier there is not much to do other than practice some examples, which i will. sadly all the crt examples are heavy on math jargon and barely ever talk about elves or santa much at all :(
>>
>start out manually looking at each frame while the robots move
>notice that sometimes the robots make lines
>write down the frame numbers that have the lines
>see that they make horizontal lines and vertical lines on specific intervals
>calculate when there will be a horizontal line and a vertical line at the same time

I had fun.
>>
>>103515187
need scared christmas elf girl sitting on a toilet with a shadow of a robot on the bottom
>>
>>103519197
That's cheating. You cheated. Forfeit your star immediately.
>>
>>103519078
0000000 because I will sell it tomorrow
>>
>>103519185
>heavy on math jargon
Go through this and find the first thing you do not understand. Correct that and proceed.
>>
>>103519247
he is one of the only ones who didnt cheat (Ie. find out how the tree looks beforehand and search for it)
>>
>>103518712
This was super noticeable with day 13. I didn't see anyone else with the same equation I had, which was derived by doing a lot of dumbass shit on a whiteboard. Come here and see that everyone is suddenly pretending to be cozy with linear algebra.
>>
File: aoc2414.png (59 KB, 517x622)
59 KB
59 KB PNG
Never done AoC before, but I seem to have gotten it working. Haven't tested the input file version (with example = 0) though.
https://www.ideone.com/ZQ396d
>>
>>103519278
>pretending to be cozy with linear algebra.
I don’t think it’s unreasonable to believe anons in a programming contest have taken a course on linear algebra. That’s 1st year university material or maybe an honours high school class.
>>
>>103519311
I agree, but
>Struggle with problem for over an hour
>oh actually, I just remembered the optimal linear algebra solution
get real.
>>
>>103519278
i mean, you're probably partly right but there are a lot of game devs on /g/, linear algebra is kinda their thing
>>
>>103519185
I suffer debilitating dyscalculia. I find it helpful to physically draw out what's going on as explicitly as possible. Don't try to visualize two things on a 2D plane, literally just look at the two quantities next to each other.

For example with CRT, consider one cycle of length 12 and one cycle of length 13. That means that each time the 12 cycle hits 0 again, the 13-cycle will be one further behind where it was last 12-cycle, right? The first time the 12-cycle hits 0 the 13-cycle will be at 12, then it'll be at 0 and 11, then 0 and 10, etc.

So that means the 13-cycle will take 13 12-cycles to hit 0 at the same time as 12, right? So we have to wait 13*12 ticks for both to be back at 0. That's why the CRT says we have to multiply the cycle lengths.

Now, 12 and 13 have no greatest common factor, so that makes this easier. But of course if there's some harmonic in the cycles, the GCF will show it and you can just use that to get the numbers you need to multiply.
>>
Day 4 has me pulling my hair. Ever since reading the problem I was like "oh fuck this is one of THOSE problems".
Even though I've solved this kind of problem before, I still have problems when I find a new one.

Please remind me what is the correct term for this kind of problem or solution, so I can read some stuff about it.
>>
>>103519278
>only i am smart enough to know high school algebra, everyone else is lying
>>
>>103519370
yes, thinking about the concepts separately like this makes perfect sense. When they are combined into one equation it can be confusing to parse out what is happening. Thanks anon.
>>
>>103515171
>didn't solve 2016 day 2
Fuck what was the prompt? I don't know what it means to be a christmas tree
>>
Oh wait was I supposed to look at each iteration?
Fucking BASED
>>
O(N^2) solution that avoids any simulation:
For each pair of bots, compute the time they sync on the x-axis. Choose the t_x at which the maximum number of bot pairs are synced.
Do the same thing for the y axis.
Since t_x has period W and t_y has period H, compute the time they sync.
This just involves solving linear congruences.
>>
>>103519404
I agree. But if it is so easy (it was), it shouldnt have taken you more than half an hour to solve. So only 10 people aren't filtered, and are lying if they say otherwise.
(yes, I did put the filter cutoff immediately after my time, how could you tell?)
>>
>>103519404
No, I'm retarded and I don't know linear algebra very well (I passed it in college but I didn't internalize much). I ended up with the highschool algebra solution. Almost everyone else ended up with the textbook linear algebra solution, which seems suspicious. I would have expected people to come up with various different solutions, if everyone was working it out themselves.
>>
>>103519374
The correct term is "easy-peasy problem nobody had any troubles to solve".
What exactly makes it hard for you?
>>
>>103519290
I just realized looping for each second is dumb.
: seconds ( u-) robots DO
nx over i dx @ * i x +mod!
ny over i dy @ * i y +mod!
/robot +LOOP drop ;
>>
>>103519374
literally just broot it what is the problem?
>>
TED
>>
>>103519439
Not everyone starts solving when the problem releases
>>
In terms of pretty pictures in problems, out of the ones I did so far I don't think any can beat 2022's day 12. The star mountain was cute
>>
NTBBA, but enjoy this bigboy alternative, I think all the approaches shown in here should still work in principle.
https://0x0.st/XFpO.txt 

I'll leave out the answer because I think that's more fun.
>>
>>103519677
Forgot array size is (606,666)
>>
>>103519439
Don't be so smug. If there were any inputs with indeterminate solution you wouldn't make it past part 1. I think that day was a bit of a trap, given that the task gave explicit bounds in the first part. I was surprised when I found out that the solutions are either inconsistent or determinate.
>>
>>103519677
Is it a skull?
>>
>>103519439
Yeah everyone in this board is a NEET without any other obligations in their life who can start working at solving the puzzle as soon as it's released every single day.
>>
I'm gonna need someone to explain how the solutions to part 2 make a christmas tree.
>>
>>103519995
Render out the grid to ascii or an image at the time step of your answer.
>>
>>103519506
You now understand Quotient Rings.
>>
>>103516481
educated guess, there’s no actual reason why that should work (it’s the easiest way to generate such a puzzle but it’s also trivial to add some overlapping points to make this invalid)
>>
>>103520024
I knew it was a thing but didn't think of it. Didn't know that name tho.
>>
File: 1734214363-896x934.png (42 KB, 896x934)
42 KB
42 KB PNG
>>103520023
I shamelessly copied another anon's solution and it just doesn't make any sense even though it is somehow the right answer
>>
>>103519500
>What exactly makes it hard for you?
the looping through the elements of what mostly is a 2d array while doing bounds checking
>>
>>103516481
>>103520043
Lots of aoc puzzles have "positive" edge cases like this, where inputs intentionally/unintentionally follow a certain format or avoid annoying edge cases.

it can be a bit annoying when you've spent 2 hours on your "proper" solution and you learn a greedy dfs works when it shouldn't. But I've accepted it as a part of aoc. Now I always make sure to try a brute force first, just in case.
>>
>>103520080
The grid has a bunch of robots moving in fixed cycles, right? They're all moving in different directions at different speeds.

Eric has planned out your input so that at one precise moment, some of the robots will all be lined up in position to make that tree. Then they all fly apart again. Your job in part 2 is to figure out, either by simulating the grid or by clever math to figure out when the robots will enter a cycle, when that moment is.
>>
>>103520083
Just write a function like safeGet, that will return null if out of bounds. What language are you using? In js it is just grid[i]?.[j], it will return undefined if out of bounds.
>>
>>103520060
Maybe less pretentious is just to say rules of modular arithmetic and mutter something about "congruence" and then walk away.
>>
>>103519374
I did BFS starting from every X for part 1. Part 2 is just check every 3x3 submatrix.
>>
>>103520083
Pad your array with a border, ancient druidic trick.
>>
Basic unwashed awk solution.

BEGIN { FS = "[^0-9-]+" }
{ g[$3,$2] = g[$3,$2] SUBSEP $5 SUBSEP $4 }

END {
for(f=1;f<10000;f++) {
q1=0;q2=0;q3=0;q4=0
for(i in g) {
split(i,c,SUBSEP) #c[1] is row, c[2] is column
split(g[i],v,SUBSEP) #v[1] is y velocity, v[2] is x velocity
for(j=2;j<length(v);j+=2) {
y=(c[1]+v[j])%103; x=(c[2]+v[j+1])%101
y = (y>=0) ? y : y+103; x = (x>=0) ? x : x+101
if(x<50&&y<51) q1++
if(x<50&&y>51) q2++
if(x>50&&y<51) q3++
if(x>50&&y>51) q4++
g2[y,x] = g2[y,x] SUBSEP v[j] SUBSEP v[j+1]
}
}
delete g
for(i in g2) g[i] = g2[i]
delete g2
if(f==100) print "Part 1: " q1*q2*q3*q4
if(f==1 || q1*q2*q3*q4 < min) { min=q1*q2*q3*q4; p2=f }
}
print "Part 2: " p2
}


Still unfiltered!
>>
>>103520168
>tranime
Knew you were not a real woman.
>>
>>103519374
MonadFail and pattern matching makes it fun
isXmasInDirection d g c = isJust $ do
let xp = c
'X' <- g !!? xp
let mp = moveCursor d c
'M' <- g !!? mp
let ap = moveCursor d mp
'A' <- g !!? ap
let sp = moveCursor d ap
'S' <- g !!? sp
pure ()
>>
File: lawyer of good sleep.png (175 KB, 500x676)
175 KB
175 KB PNG
Get some sleep, European anons!
>>
>>103520179
define tranime
>>
This part 2 is really dumb since you basically need to head Eric's head.
>>
>>103520190
Filtered-kun, I...
>>
>>103520190
I just scrolled through my output until I saw a tree, it was only about 60k lines in. Not filtered btw.
>>
File: 1479707180708.jpg (31 KB, 316x340)
31 KB
31 KB JPG
>>103520197
>implying you knew the tree shape
>implying you knew whether the tree was filled or hollow
>implying you knew any distinctive feature that would help with the search
>>
>>103520197
Not filtered. Just stating the truth.
Any algorithm you write to detect "Christmas trees" I can give you a new tree that will not covered by your algorithm.
If you say "I can just update the algorithm to handle the new case!" then your definition of tree becomes so broad that will consider virtually anything a tree.
>>
>>103520246
My solution was:
>determine the period of each robot (the velocities are coprime with the width/height so it turned out to be 10403 for each robot)
>Generate 10403 grids
>Redirect the output to a file
>Randomly search ######
>Find the result
>Lose a minute because of off-by-one
It's not fucking hard anon.
>>
>>103520246
My first thought was that it would be diagonal lines running through the quadrants. That definitely lead me down the wrong path at first.
>>
>>103520262
Today isn't an algorithm day, filtered-kun.
>>
>>103520246
I knew a bunch of points would be clustered together
>>
>>103520246
I knew there would be some pattern of many adjacent bots
I knew a frame where "most of the bots" form some pattern would have much lower entropy than average
Knowing exactly what the pattern is is unnecessary
>>
>>103520246
You're allowed to try something, and maybe it doesn't work, maybe it does work. If it doesn't work, you're allowed to try something else.
What the heck is with all the people complaining about solving a puzzle in a sequence of 25 puzzles?
>>
>>103520262
The problem wasn't "Create a program capable of finding every possible Christmas tree ever." It was "Find the Christmas tree in your input." Skill issue: Not identifying the correct scope of problem to solve.
>>
>>103520246
I ran through iterations at 20 fps until I saw the tree and then wrote my search once I knew the shape.
>>
>>103520263
>>Randomly search ######
Wouldn't work for all tree shapes. Eric should have made a troll tree with zero continuous robots in a row and a curved shape.
>>
>>103520369
>Wouldn't work for all tree shapes.
Retard-kun, the question isn't to find all possible trees.
>>
>>103520380
And what if you make a wrong assumption in your searches? Not everyone thinks the same.
>>
>>103520303
80% of people are complete npcs that operate solely on repetition and memorization and have no idea what to do when encountering a novel problem.
The internet has increased this problem 1000x, as anytime you don't know something, you can just look up the undisputed correct answer. This has caused an epidemic of learned helplessness and authority worship.
>>
>>103520386
Search again then. You have eyes, right?
>>
>>103520387
Dude, this just happened when I bought new tires. The guy had me go through a computer quiz and then told me what the #1 recommended tire for me was. I told him thanks, but I know exactly the tire I want and it wasn't what the computer spit out. His brain almost bluescreened.
>>
Dear Eric,

I am writing to express my profound dismay and utter disbelief at the recent puzzle that asked participants to find a Christmas tree. This seemingly innocent activity is, in fact, a microcosm of everything wrong with our society today.

Firstly, the very concept of a Christmas tree is deeply problematic. It perpetuates a Eurocentric, Christian-centric worldview that marginalizes and excludes countless other cultural and religious traditions. By centering a Christmas tree, you are effectively erasing the rich tapestry of diverse celebrations that exist around the world.

Moreover, the act of "finding" the tree is inherently ableist. It assumes that all participants have the same visual and cognitive abilities, thereby excluding those with visual impairments or neurodivergent conditions. This is a blatant disregard for inclusivity and accessibility.

The puzzle also reinforces harmful environmental practices. Encouraging the search for a Christmas tree, even in a puzzle, normalizes the cutting down of trees and contributes to the ongoing destruction of our planet's forests. This is an egregious oversight in an era where we should be promoting sustainability and environmental stewardship.

Additionally, the puzzle's competitive nature fosters a toxic environment of individualism and competition, rather than promoting community and cooperation. This is a reflection of the capitalist mindset that prioritizes personal gain over collective well-being.

In conclusion, I urge you to reconsider the themes and messages you are promoting through your puzzles. It is imperative that we move towards more inclusive, environmentally conscious, and community-oriented activities that celebrate the diversity and richness of all cultures and abilities.

Sincerely,
A Concerned AOC Participant.
>>
>>103520407
Christianity is not European, and Christmas trees are not Christian.
>>
>>103520332
The point is to "Find the Christmas tree in your input." you need to know what a "Christman tree" means in this context.
Since there are countless ways it could be represented you're basically guessing in the dark.
>>
>>103519939
It's several little pictures after a long cycle. Maybe I should've stuck to one image.
>>
>>103520424
>Christmas tree
>Christ
I wonder what anon meant by this. Please don’t respond about Yule, I know.
>>
>>103520407
Thank you for signal boosting my minority viewpoint to Eric. Given the hostile responses I received I propose that AoC adopt a Code of Conduct. Many projects have already introduced a CoC and most of them are based on the Code of Covenant, which protects minorities and neurodivergent people just like me.
I think it is important to the AoC community to protect the most vulnerable and urge you to adopt a CoC as soon as possible.
>>
>>103520246
>implying you knew any distinctive feature that would help with the search
imagine not knowing how an ascii christmas tree looks.
you can even compare the whole images with each other, just to detect if there's a cycle - this narrowe down the search space
>>
>>103520426
See >>103517834
>>
>>103515171
bros... just started part 2... am i filtered?
>pic related
>>
>>103520426
Skill issue. Most real world problems are poorly defined.
>>
>>103520407
Yes, I would like to find the Muhammad.
>>
>>
>>
>>103520426
I wonder if any of those "countless ways" might have something in common....
>>
File: test.gif (1.12 MB, 250x162)
1.12 MB
1.12 MB GIF
>wrote to a folder the txt
>was going through each one of them
>gave up around 500
I didn't think to use an image and use the thumbnail kek.
>>
>>103520426
Spatial correlation
Entropy
Run length encoded size
Manual inspectiom
Adjacent pixel count
Length of longest line of points
Fewest overlapping points
Minimum average distance between points
Searching for any small rectangle, line, or diagonal
Any of these worked
You didn't need to know what it looked like at all
>>
>>103520426
>Since there are countless ways it could be represented you're basically guessing in the dark.
And? Name 3 of your guesses that didn't work. You didn't try nothing and then come here to seethe about being retarded. Right anon?
>>
>>103520636
Yes they have in the same way that all dog pictures have something in common.
Now write me simple (i.e., without machine learning) general algorithm to detect dogs. I will wait.
>>
File: apl14.png (22 KB, 761x343)
22 KB
22 KB PNG
My APL solution for Day 14. Part 1 just multiplies each position by the velocity*100 and modulos to get the positions in bound. Part 2 brute forces 10000 iterations and creates a boolean matrix where 1 is a robot at that position, then shifts it down 1 and ANDs it with the original matrix. The count of 1s left after the AND is around 50-70 for most of the iterations, and 267 for the Christmas tree.
>>
>>103520666
>detect the single picture most likely to be a dog, where most of the poijts are in the dog picture, from a set of 10000 pictures of random noise
Yeah that's pretty easy, any of today's solutions would have worked as well
>>
>>103520648
>Name 3 of your guesses that didn't work.
If the tree was small then you could look states with the highest number of points in the same position.
If the tree was centered in the grid then you could reuse the solution from part 1 to find states where the number of points in each quadrant are symmetrical to each other.
If the tree used all points in the image then you could just search for states with a single connected component.

Stop defending this garbage.
>>
>>103520757
So, which ones did you actually try?
Checking the compression ratio would have worked for all of those, by the way.
>>
>>103520757
your first option is very similar to what >>103518421 does
>>103520723
>shifts it down 1 and ANDs it with the original matrix
I kept trying dumb alternatives to this simple check...
>>
>>
>>103520816
It took me a while to come up with that, at first I was doing an outer product on each position to check how many were adjacent to each other, Dyalog didn't like that very much though.
>>
>>103520842
Does it have a convolution operator? I would expect any array language to.
>>
>>103520842
>>103520928
https://aplwiki.com/wiki/Stencil
>>
Just realised the sides are prime, making every offset coprime, meaning they'll loop every 101x horizontally and 103x vertically, meaning the pattern repeats every 10403x.
>>
File: Woke slop.png (637 KB, 2139x1240)
637 KB
637 KB PNG
>>103520407
This was AI generated, but I was pretty impressed that I couldn’t distinguish it from genuine woke nonsense you see in the wild. The part about the trees made me laugh, I wasn’t expecting it.
>>
>>103520999
kek
>>
>>103520840
>get sick
>I literally couldn't open my eyes without being in pain
>got filtered
FFS.
>>
>>103521023
Nature is cruel, and the weak deserve to be culled.
>>
>>103521023
Then catch back up and become unfiltered. I've done that a couple times now.
>>
>>103521023
Skill issue, literal blind people solve these problems (except the one with the terminal output lol).
>>
>>103521023
skill issue
>>
>>103521044
WHAT
YOU COULD BE UNFILTERED
I THOUGHT IT WAS A ONE AND YOU'RE DONE
FO R FUCK SAKE
>>
>>103520179
Trannies do not have ownership of wholesome anime, you sicko.
>>
>>103521050
I think there are two filter anons. One guy makes it permanent, the other lets you resurrect. I think such anons should be represented in dashed lines to emphasize their zombie status.
>>
>>103521050
There's 2 different people posting charts, one of them has a 24h time limit, the other doesn't.
>>
>>103521092
>>103521089
Great, I was going to wait till Christmas break. Now I gotta go into overdrive to catch up. Wish me luck
>>
>>103521089
green: alive
white: resurrected once (like Jesus, THE REASON FOR THE SEASON)
red: dead but still here and waiting for the second coming
absent: fully filtered
>>
>>103521115
Best of luck, I hope you make it. However, just as you cannot unsuck a dick, in my book you’re permanently and irrevocably filtered for 2024.
>>
>>103521050
if you dont finish a puzzle within 24 hours you are filtered (permanently)
>>
>>103521023
This is the one question where you can legitimately feed it into an LLM
>>
>>103519677
got me good, anon...
you're the goat...
>>
>>103520426
Simple maths tells you there's only ~10k unique patterns. Takes less than a second to check every single one for e.g. a line above a certain length.
>>
What if there's a tree of zero size?
>>
>>103521216
then the answer would be 0
>>
>>103521216
Can't be, it says "most" (meaning more than half) of the robots are part of the pattern. The tree must at least have size one.
>>
just realised i could have used my day 12 code on day 14 to check how many regions there are, and the tree would probably have the lowest number
>>
>>103521234
it'd have the largest region, but that's assuming it's contiguous.
>>
As a corollary of the halting problem it's impossible to detect an arbitrary Christmas tree
>>
>>103521268
You can probably try to detect an abnormality in a uniformity of robots distribution. Won''t solve the detection of an arbitrary christmas tree obviously, but will pick a lot of possible designs.
>>
>>103520840
Could another 60 of you get filtered so I can finally let myself get filtered and get some rest?
>>
>>103521023
Unless you were quite literally dying, that is not a valid excuse.
>>
>>103521216
>Still in disbelief about 0-length files
Just because they're 0-length doesn't mean they don't exist and they still have a memory address and that address should not be used by any other file, therefore they take up 1 memory unit.
Idiot
>>
>>103521310
you being the last anon remaining doesn't preclude you from getting filtered yourself
>>
Rust bros... Did we win? https://doublefree.bearblog.dev/solving-advent-of-code-at-compile-time-with-rust-macros/
>>
Curious if anyone has built a diffuser that can solve this problem without cop outs like, um sequential sets of robots in a line.
>>
>>103521420
you mean like the entropy solution or the minimum axis projection variances? there were quite some people that came to similar solutions that are quite general.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.