[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] [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: day12duck.png (64 KB, 579x584)
64 KB
64 KB PNG
>Everybody Codes is a free space for honing your coding skills, experimenting with ideas, and learning from others. At its heart lies the belief that programming is best when shared - whether through solving puzzles, streaming your progress, or discussing solutions.
https://everybody.codes

Similar to Advent of Code but in November. Puzzles drop at 4PM EST with weekends off

>oh no I started late
Can sort leaderboards by "local time" which doesn't start the clock until you open the puzzle. Not used for global ranking but still fun to be able to compare how you did

/g/derboard code
4151e976-7b9f-4fda-bb33-fa7c70fdceea

Last >>107208342
>>
baked a new one for you lads, see ya in half an hour for day 13
>>
FILTER DAY INCOMING, HOLY SHIT
>>
5 MINUTES
>>
>>107265692
ive never done one of these and im too intimidated to start
>>
>Your solution fort Part II should work for this one as well.
h-haha, yeah
>>
>>107266023
i just said fuck it and it only took like 10 seconds for my unwashed python to do it lel
>>
wheel = [1]
end_wheel = []
for idx,n in enumerate(nums):
if idx % 2 == 0:
to_add = wheel
else:
to_add = end_wheel

n = n.split("-")
start = int(n[0])
end = int(n[-1])
diff = end - start
for i in range(diff+1):
num = start + i
to_add.append(num)

wheel = wheel + end_wheel[::-1]
full_turn = len(wheel)
to_turn = 202520252025 % full_turn
print(wheel[to_turn])


I'm sure there's a smarter way of doing this that doesn't need you to actually stuff 250 million numbers into an array but this wasn't even that slow so whatever. maybe if someone posts a big boy i'll look into that
>>
>>107266023
okay, solved it the smart way, that wasn't so bad

>>107266112
>>107266149
really? my brute didn't get past the first range after ten seconds so I just assumed I couldn't brute it.
>>
>>107266112
Same. It's only about 500 * 500,000 = 250m list items, which if you're just naively building a deque is really not very much data.

>>107265997
The difficulty ramps up pretty slowly from the first puzzle, just start at the start.

>>107266186
What language and data structure? I just used a Python deque (double ended queue) which has O(1) insertions at both ends of the list, so you're really only benchmarking how long it takes to loop over 250m items and then do the constant time modulo math at the end to get the answer.
>>
>>107266186
10 seconds was a little bit of an exaggeration, but i went back and timed it and the whole thing took my code 60 second so still not an insane wait

>>107266238
i guess the real "brute force trap" was maybe if you aren't even doing the modulo and just cycle through the wheel 200 billion times
>>
File: hat.gif (1.36 MB, 453x344)
1.36 MB
1.36 MB GIF
>range problem
>>
File: file.png (20 KB, 854x335)
20 KB
20 KB PNG
>>107266280
10s isn't unreasonable, mine finishes in ~13 on an older 11700k. A newer Zen chip could probably get that under 10s no problem.
>>
File: EC-13.png (150 KB, 675x1567)
150 KB
150 KB PNG
Kept stumbling on off-by-one errors and other stupid indexing mistakes.
>>
>To open the door, turn this three hundred million point dial around several hundred times
FUCKING ELVES-I MEAN, DUCKS
>>
>>107266474
>Guard 1: Just rotate the first dial South-West, the second dial East, and the third dial North-West. It doesn't have to be exact, the millions of numbers are just to scare off potential lockpickers.
>Guard 2: Ok lol

>Dragonduck: Hmm, now for lock three, I must find the EXACT value out of this hundred million number lock to open the door! I'd better get started!
>>
File: ec2025-13.png (212 KB, 593x1740)
212 KB
212 KB PNG
I didn't broot this time
>>
>>107266322
was referring to an earlier post where i said my unwashed code took 10 seconds when it really took 60, i definitely believe that under 10 is possible even with a brute force-ish solution
>>
File: carbon.png (117 KB, 784x680)
117 KB
117 KB PNG
>>107266575
I know, here's my (washed) Python bruteforce that takes ~13s

I kinda wanna go back and rewrite it the smart way, but I've done enough of these fucking range problems over the years of AoC.
>>
cucker test
>>
File: 12.png (2.6 MB, 1536x1024)
2.6 MB
2.6 MB PNG
ahh I got filtered on time. good luck boys. I'll try and catch up when I catch up on work.
>>
I've been doing the intcode days from AOC 2019 since I quit that one relatively early. It's been enjoyable doing at my own pace like this but I'm kind of remembering why this pissed people off at the time. For several of the days, I've rewritten big parts of my code just to make it maintainable for the new day's changes, I could see that being something you'd be resistant to doing if you stayed up til midnight to burn through the puzzle as fast as possible for a competitive time

But really it's impressive on Eric's part, some AoC puzzles, even hard ones, seem like they wouldn't be that much work to put together but these intcode ones must have been a pain in the ass to assemble
>>
>>107267001
you better not quit, ai duck poster, your images are the only "culture" these thread have
>>
File: 9789q5234.png (9 KB, 546x292)
9 KB
9 KB PNG
UNEMPLOYED DOMINANCE
>>
>>107267075
I've been meaning to ask, how do you change you're flair on the website.
>>
>>107267197
it's a "Team", just go the /g/derboard page, click on the "Teams" tab and there' s a little "Set my Team" button

The team scores are just additive though so doesn't really mean much if the teams have different numbers of members
>>
can I get a difficulty rating for today?
>>
>>107268099
1/10
2 if you're tired
>>
File: carbon (1).png (560 KB, 1600x2292)
560 KB
560 KB PNG
Lots of trial and error, ranges are too high-iq for me but it's doable.
>>
File: carbon.png (146 KB, 784x903)
146 KB
146 KB PNG
>>107266624
I was idly thinking about the problem later while making dinner, and an O(n) solution (where n=number of ranges) that's only slightly different from my broot code occurred to me. New runtime isn't measurably different than running an empty script.
>>
File: 13.png (1.49 MB, 5708x5012)
1.49 MB
1.49 MB PNG
>>107267075
not anymore
>>
File: d13.png (1.1 MB, 590x916)
1.1 MB
1.1 MB PNG
Wow, today was super short... just "do you know deque? (Y/N)" It's probably a lot faster to emulate the range positions though, but it was only a few seconds to add them.
>>107267049
了解
>>
bigboy #13
url: https://files.catbox.moe/cmri94.7z
ranges: 10M
huey: n/a
dewey: 5346253
louie: 6705614
>>
>>107268965
What's the point for a bigboy when the solution is trivially O(n)?
>>
>>107269005
post time
>>
>>107268454
oh that’s clever nice job.
i’m sure you other guys are clever too. but i can read this one!
>>
>>107268965
>100k/s
https://gofile.io/d/Mdhppo
you niggers gotta find a faster site before AoC starts
>>
File: carbon (3).png (430 KB, 1680x1844)
430 KB
430 KB PNG
>>107268965
$ time ./a.out <bigboy.txt
5346253
6705614

real 0m1.410s
user 0m1.166s
sys 0m0.229s
>>
File: carbon(11).png (366 KB, 1600x1666)
366 KB
366 KB PNG
>>
File: 1703232917871350.jpg (183 KB, 1096x895)
183 KB
183 KB JPG
How're we feeling about the "difficulty" curve of everybody codes vs AoC?

Honestly I don't mind the easy puzzles, it's nice to just have something I can knock out in 45 minutes every day. For AoC I barely ever make it through the second week
>>
>>107270140
same
different inputs for each part is what puts me off
>>
>>107270149
I don't mind that too much as long as they're the same structure. I did a couple puzzles from the 2024 version of EC and one of them added a second input on part 2 that was tedious to parse. shit like that is just annoying. today's puzzle changed up the structure with the ranges in part 2 but it wasn't that big of a deal
>>
>>107270140
The dragon chess was definitely the hardest but it was just complex to implement, I haven't been expected to do a huge logical leap yet.
>>
I finally unfiltered myself and finished day 10 (dragon/sheep chess). Was that just a random difficulty spike or have they all been similarly difficult since then?
>>
>>107270140
My perception of difficulty might be off from doing hundreds of AoC puzzles, but like the other anon said, it's all been easy except dragon chess (10).
The main thing that confuses me is how multiple puzzles (6 and 13 for sure so far) have come up where it feels like the intention is to make them not bruteforceable by part 3, and extreme optimizations really aren't that tricky, but they didn't have the balls to crank the numbers up enough for a rough Python bruteforce to OOM and/or take more than a couple of minutes. I'm not sure if I like that or not, but out of habit I've been cleaning up my code post-completion, often with more carefully rewritten, efficient algorithms anyway (the same sort of algorithmic improvements I'd typically make to an AoC solver after getting my test cases working, and realizing the real input is 100 trillion times more difficult).

>>107271573
Just a spike, I'm not super fast and days 11, 12, and 13 took me an an hour and fifteen minutes combined.
11 part 3 has an annoying math trick that's not complicated but also not immediately obvious and tripped a bunch of anons up; pay attention to your input.
>>
>>107270479
>>107271573
>>107271711
Where was the difficulty for day 10?
I haven't attempted it, but I'm curious.
Is there a "gotcha" once you log in and see the real dataset?
>>
File: EC-10 Part 3.png (55 KB, 973x611)
55 KB
55 KB PNG
>>107271805
Part 3 gives you the rules for a basic game and has you calculate how many possible ways of playing it lead to victory. The answer's in the hundred trillion ballpark so you need some effective memoization and it's a bit of a pain to debug. Not immensely challenging but a step up from the problems that had come before.
>>
12 got me stuck! How did you guys solve 12 part 3? There's cycles with same strength bombs so dfs gets stuck and the time and memory is too big to brute force. :(
>>
>>107272780
>too big to brute force
you're a disgrace to this family
>>
>>107272780
literally just follow the description.
>>
>>107272780
You should be able to apply the same methods you've been using for parts 1 and 2. You just need to be smart about which ones you check. For example if a barrel has been hit in a previous check, there's no point trying it as the starting barrel as it won't cover a larger area.
>>
>>107272254
I see, that looks much harder than the first one
>>
>>107272849
>>107272828
>>107272797
wow got it thanks! yaaaa turns out I was trying get the "best" solution instead of the "greedy" and storing big sets of visited. reading is hard. :(

grid = [[int(x) for x in list(y)] for y in data.strip().splitlines()]
h, w = len(grid), len(grid[0])
def dfs(y, x, g):
q = [(g[y][x], y, x)]
g[y][x] = 0
while q:
s, y, x = q.pop()
for ny, nx in ((y+1,x), (y-1,x), (y,x+1), (y,x-1)):
if not (0 <= ny < h and 0 <= nx < w):
continue
if not g[ny][nx]: # visited
continue
if s >= g[ny][nx]: # can move to <= height
q.append((g[ny][nx], ny, nx))
g[ny][nx] = 0 # mark visited
best = set()
for i in range(3):
res = (0,0,0)
copy = [row[:] for row in grid]
for y,x in best:
bfs(y, x, copy)
for y in range(h):
for x in range(w):
if (y,x) in best:
continue
if copy[y][x] < 3:
continue
test = [row[:] for row in copy]
dfs(y, x, test)
total = sum(1 for row in test for x in row if x == 0)
if total > res[0]:
res = (total, y, x)
best.add((res[1],res[2]))
print(best)
print(res)
>>
>>107273710
now try the bigboy >>107258029
>>
File: 2e3-2950154986.png (227 KB, 680x680)
227 KB
227 KB PNG
>>107273737
>>
>>107271711
I don't remember why, but day 2 took me longer than any puzzle this year except day 10 (chess). That made me expect the difficulty curve was gonna be crazy, but yeah it's felt pretty flat for the most part

agree with you on the fake brute force traps, it's funny seeing these part 3s that are just "ok now do part 2 a million times" but my part 2 solution still finishes it in like 10 seconds

>>107271805
day 10 part 3 pretty much requires memoization. not really a crazy gotcha, AoC has like one memoization puzzle a year so it should have been obvious to anyone who has been doing these things for a while, but still harder than most of the other puzzles where you can pretty much do everything step-by-step according to the instructions and be fine
>>
>>107273999
>day 10 part 3 pretty much requires memoization. not really a crazy gotcha, AoC has like one memoization puzzle a year
to be honest I would've attempted memoization even for part 1 already (because I would expect the dataset to become larger).
What did you use as memoization criteria in part 3? Since the individual sheep can move, it seems there's not that much to memoize. Even if the dragon ends up on the same position as in a previous run, the sheep could be positioned differently, right?
>>
>>107274042
yeah part 1 was already an obvious set up for it, but if you didn't memoize you weren't really punished until part 3

>Even if the dragon ends up on the same position as in a previous run, the sheep could be positioned differently, right?
I think it's more that the dragon's paths that diverge on its first turn can easily converge again on its second turn, so if you just treat those paths as unique, you're wasting a ton of time that are essential duplicates except for one turn and that just compounds every turn
>>
>>107274042
>>107274549
>What did you use as memoization criteria in part 3?

State of the gameboard (dragon and sheep position) but only on the dragon's turn. Did DFS and stored whether that state eventually landed on a win or not so that those converging paths could finish quickly
>>
2-ISH HOURS LEFT
>>
File: 1399473064104.jpg (6 KB, 254x238)
6 KB
6 KB JPG
>>107271573
Okay day 11 was stupidly easy, what a relief
>>
5^2 MINUTES
>>
5^1 MINUTES
>>
MASSIVE FILTER INCOMING, PUCKER YOUR ASSHOLES
>>
>>107276528
nah that's tomorrow
>>
File: file.png (27 KB, 376x265)
27 KB
27 KB PNG
>>107276540
So now, got it
>>
Looks easy enough. Going to bed now, let me know how part 2 and 3 look like
>>
>part 3
oh lord. here we go
>>
>this part 3
uh, brute force sisters???
>>
>>107276631
>>107276679
Can you upload a screenshot to https://catbox.moe/ so it doesn't spoiler?
>>
>>107276688
maybe after i finish ;^)
>>
spent 15 minutes just trying to figure out the indexes of the center square lel
>>
>>107276837
>spent 15 minutes just trying to figure out the indexes of the center square lel
ya wtf. the diagrams don't make sence with the description
>If a tile is active, it will remain active in the next round if the number of active diagonal neighbours is odd. Otherwise, it becomes inactive.
If a tile is inactive, it will become active in the next round if the number of active diagonal neighbours is even. Otherwise, it remains inactive.
. #     # #     # .     . #     # .     . .
# . . # # .
. . # # # . # # . . . .
>>
Easy stuff. Give me a real filter!
>>
>>107276895
i meant for part 3, the stuff you posted made sense imo. for each coordinate, see how many of the four diagnol neighbors are "active". that number along with whether the coordinate was already active determine if that coordinate will be active on the next round

it's basically conway's game of life but tweaked
>>
File: carbon.png (474 KB, 1750x1922)
474 KB
474 KB PNG
Takes 9s.
My code for part 3 is wew. Maths is very explicit but at least I didn't fuck it up anywhere. It won't work if there are 2 equal state differences but thankfully that's not the case. If that happened I'd have to compare entire board states I guess.

Maybe we can make use of the fact that it only looks at diagonals, that is it's basically two separate diagonal grids. Tiles whose coordinates sum to an odd number are independent of those that sum to an even number. So we can calculate their loops separately and see when they form the pattern in the middle.

PS. can't upload images, imagine 2 liner first two parts and a 10 liner to calculate loop offsets.
>>
>>107277094
Managed to upload it after all, little shit.
>>
>>107268965
blech, my code feels slow
Part 1: 782

Part 2: 5346253

Part 3: 6705614


real 0m2,085s
user 0m1,804s
sys 0m0,280s
>>
File: EC-14.png (265 KB, 703x2861)
265 KB
265 KB PNG
Absolutely horrific unwashed ass.
>>
>getting 40 billion for part 3 test instead of 300 million
shiiiiiet
>>
File: carbon.png (221 KB, 1190x1140)
221 KB
221 KB PNG
>>107268965
Couldn't post yesterday, 5s in python.
3806
5346253
6705614
>>
>correct answer on example
>wrong answer on actual input
one of these days again
>>
File: carbon.png (669 KB, 1278x6056)
669 KB
669 KB PNG
>spent an hour debugging what ended up being some off by one errors with the index
such is life. still, kinda fun puzzle with the extra math shit

here's 140 lines of unwashed ass nobody will read
>>
>>107277592
Oh I got it
I only added the total cycle count at the end of every cycle, while it increments a few times during the cycles as well, so I was missing some valid patterns at the end.
>>
File: 14.png (3.14 MB, 1536x1024)
3.14 MB
3.14 MB PNG
How's today duck buddies? You pondering?
>>
>>107277732
parts 1 and 2 are trivial, part 3 took some time to implement but isn't anything that crazy
>>
File: quest15.png (271 KB, 2419x2917)
271 KB
271 KB PNG
Best problem thus far.

>>107277672
Here's some more that no one will read, but I added some pictures.
>>
File: day 14 visual.gif (3.52 MB, 102x102)
3.52 MB
3.52 MB GIF
[SEIZURE WARNING]
visualization of the floor in part 3
(the whole gif is over five minutes long)
>>
File: 1672376353697444.jpg (72 KB, 640x480)
72 KB
72 KB JPG
>>107277903
trippy. it's cool how it'll get to a semi-stable state where the pattern just looks like its kind of pulsing and then suddenly explode
>>
I have a brilliant idea
AoC Dec 1-12
EC Dec 13-25 [also adopts christmas theme]
>>
File: d14.png (2.54 MB, 818x2052)
2.54 MB
2.54 MB PNG
All caught up now! Just manually found the [spoiler]cycle[/spoiler] and did the math though.
>>
File: xmas_time.png (2.62 MB, 1536x1024)
2.62 MB
2.62 MB PNG
>>107278747
I I'd be down for that. I love crossover episodes.
>>
>>107278747
brillianter idea:
>advent of /g/ jan - oct
>EC nov
>AoC dec
>>
>>107279053
brilliantest idea:
>aoc 365 days a year
>each day is harder
>on erics death 100 years from now everyone with 100% completion receives a golden usb key
>last 3 puzzles unlock phyical 3 doors to his puzzle factory
>getting an answer wrong results in death
>unlocking the last door wins you his tiny shitty stash of jane street sponsorship money and the keys to become the new AOC wonka puzzle chump riddler
>>
>>107279053
>>107279105
I can't do puzzles every day. Life needs a natural ebb and flow
>>
File: mightyducks.png (2.12 MB, 1024x1024)
2.12 MB
2.12 MB PNG
>>107277903
Woah that's cool!
>>107277094
>>107277672
Man I usually try to read at least the python solutions because I can understand python. But both these are pretty wild to me.
>>107277094
This is bananas. Why do you only need the last few states?
>>107278990
Ahhh fuck I left the notes in the middle. :( Embarassing.
>>
>>107279113
filtered
>>
File: carbon(12).png (852 KB, 1340x4160)
852 KB
852 KB PNG
>>
>>107279192
>>107277672 (Me)
>Man I usually try to read at least the python solutions because I can understand python. But both these are pretty wild to me.

Yeah I think I "overengineered" it

basically...
>save input coordinates for the center that i'll have to match against
>create "seen_states" dictionary where I'll store the state of the grid after every round, that way I can find where it cycles and wont have to do all gazillion rounds
>iterate through each round of the simulation, saving the state
>while iterating, see if the center area matches the input; if it does, save the total number of active tiles along with the round index
>once the cycle repeats, quit the loop
>find out how many times the cycle loops to finish a gazillion rounds
>multiply that by the combined active tiles from the rounds where the center matched the input
>then get the remaining cycles to finish out the gazillion and only add tiles from the center match states that were from a round less than that remainder

I assume this is basically what everybody did, probably just with some smarter data structures instead of like 10 different dicts and sets like me
>>
File: IMG_8627.gif (2.94 MB, 480x360)
2.94 MB
2.94 MB GIF
>>107279599
Wow this is actually an impressively high effort shit post
>>
Which day was the fractal again? I want to do that in a meme way but you get penalized for opening days and not doing them.
>>
>>107280104
Day 2
>>
>>107279991
that's what you were supposed to do, yes
the trick would've been to make the start of the cycle be somewhere in the middle of the total seen states and needing to account for the cycle length being smaller than the total unique states length

>>107280104
day 2 was simulate the mandelbrot set
>>
>>107280124
>>107280134
Baller, thanks.
>>
File: carbon.png (235 KB, 1024x1108)
235 KB
235 KB PNG
>>107279991
Yep, that's precisely what I wrote for part 3, down to the variable names.
>>
File: 14.png (1.07 MB, 2878x4424)
1.07 MB
1.07 MB PNG
>>
>>107279192
>This is bananas. Why do you only need the last few states?
I need all states where the pattern appears, I just check diffs between their occurences which is a bad idea. It's better to save the entire state and check if it repeats every time you find the pattern, like >>107279991 but without saving every single iteration. Loops were easy this time, that's why my method works.
>>
nigger
>>
>>107280056
Glad it was appreciated. The idiot admins just keep range banning and mass deleting posts.
>>
File: carbon.png (519 KB, 1600x2478)
519 KB
519 KB PNG
Decided to optimizetroon this one, pretty fun. I think this is as optimal as it gets?
>>
>>107280926
>simulating the whole 34x34 field
you only need to simulate a quarter, since it's symmetric
>>
>>107280958
Possibly you could get away with only simulating an eighth as it's symmetrical along the diagonals as well, but that's probably more trouble than it's worth.
>>
File: ec2025-14.png (322 KB, 593x2649)
322 KB
322 KB PNG
wew
>>
>>107280958
Damn, didn't think of that. The boundaries would be difficult though, I think you'd need to prepare a padding before the convolution.
>>
The evolution is an affine transformation so there are probably some linear algebraic methods that could be used for this. But for 34x34 this doesn't seem worth it.
>>
>>107265692
man, i hate these problems with cycles, it's always a off by one error involved that takes a lot of time to find
>>
File: ec2025q1part2.png (45 KB, 535x259)
45 KB
45 KB PNG
>>107265692
Quest 1
;;lang: clojure

(let [[names instrs] (->> "i/1.txt"
slurp
str/split-lines
(remove str/blank?)
(mapv #(str/split % #",")))
maxidx (dec (count names))]
(->> instrs
(mapv #(str/replace % "R" "+"))
(mapv #(str/replace % "L" "-"))
(mapv parse-long)
(reduce #(max 0 (min maxidx (+ %1 %2))))
(names)))
>>
File: baba is bump.gif (79 KB, 496x398)
79 KB
79 KB GIF
>>
>>107280134
>the trick would've been to make the start of the cycle be somewhere in the middle of the total seen states and needing to account for the cycle length being smaller than the total unique states length

yeah this was kind of what I was anticipating in the beginning, that the pattern would start "chatoic" but then eventually get to a semi stable pattern and you'd need to account for both the "chaotic" beginning and the unfinished last cycle in addition to the cycles. was kind of miffed when that wasn't the case and the "repeat point" was just the first round
>>
>>107280346
>It's better to save the entire state and check if it repeats every time you find the pattern, like >>107279991 but without saving every single iteration

oh shit you're right, we don't really care what the full cycle is, just the cycle in the pattern matching states. dam, wish I'd thought of that, would've cleaned my code up substantially
>>
how do you guys sustain the motivation to keep solving programming challenges?
to me they all either fall into the group of "too easy and obvious" or "too bullshit, probably requiring some previous knowledge of algorithms or math that you'd never come up with by yourself"
and in both cases it just kills my motivation to solve any of them
>>
>>107284013
What would you never come up with yourself? I haven't seen any special algorithm yet.
>>
>>107284013
most people who do these still find it satisfying to blow through the easy ones and then either get filtered by the hard ones or enjoy the challenge of the hard ones

honestly, thinking you're too good for the easy ones but then coping about how the challenging ones are just bullshit sound like some ego shit that seems to be very common with programmers. everything you know how to do is simple and effortless, everything you don't know how to do is unfair and has no real world application anyway
>>
>>107284013
>or "too bullshit, probably requiring some previous knowledge of algorithms or math that you'd never come up with by yourself"
You see, this is where you're wrong. I'm not the best programmer, but I am too much of a narcissist to let that stop me. It takes me less time to ego my way through a hard problem and solve it much better than the absolute majority of programmers than it takes most of you to even remember and look up what algo to use, and the only one who consistently beats my bigboy times is the Rustfag who I admit is very good. The only algo I know by heart is Dijkstras, and I don't bother looking up anything else, I just do whatever works and I know that it will work because I'm better than every single one of you.
Because unlike the Rust faggot this is all natural skill with no training. I don't spend time on anything, I just ego code and solve problems as I face them.
Narcissism is a super power. You should try it.
>>
If I feel like a question is poorly worded I copy someone else's solution. It's unfair for me to lose ducks because temu Eric can't write.
>>
>>107285441
Let me guess, everything past day 3 was "poorly worded"?
>>
>>107284830
lol is this your first AoC-like? If you did previous AoCs, I seriously doubt you did the chinese number theorem problems if you didn't know the formula already by just "figuring it out" on your own
>>
File: BeatThis.png (13 KB, 199x357)
13 KB
13 KB PNG
>>107285689
I have taken all 500 stars, every available duck, and conquered every Bigboy so far in this event and in AoC 2024. I have zero clue what the chinese number theorem is, nor do I care.
>>
File: 8knr42.png (161 KB, 430x360)
161 KB
161 KB PNG
>>107285441
I agree sar to chit test well is jadoo of brahma.
>>
File: morning.png (1.68 MB, 1024x1024)
1.68 MB
1.68 MB PNG
Almost showtime boys!
>>
massive filter incoming
>>
>>107287074
yeah that's today
>>
>>107285836
Well, yeah, sure, if you just copy paste solutions you can get all the stars and ducks.
>>
5 MINUTES
>>
>>107287135
I get that you can't solve shit on your own, but don't project.
>>
Wtf? How do I dijkstra this?
>>
>just printed out map and counted manually for part 1 and 2
lol i'm going to be punished for this in part 3 but fuck path finding
>>
>>107287513
now this guy is power compuuting
>>
>>107287492
ahh i just defaulted to 0,0 and if something doesn’t exist it’s an empty space
>>
>>107287747
Nah I was talking about the fucking part 3. I already figured out I need to make a graph and check if paths between corner nodes intersect with segments. That's for tomorrow
>>
Hmm...store all the walls as line segments, obviously.
         
X X
#####
X#X
#
#

For every corner store each diagonal coordinate X as a node. Or I guess actually each line segment, store the 4 diagonal corners at the end of each line segment.
Dijkstra over it, and consider:
- paths from corner nodes to other corner nodes with direct line of sight (this is like 80% of correct pathing)
- paths from corner nodes to other corner nodes with 1 right angle turn that also don't pass through a wall
Obviously weight the Dijkstra with Manhattan distance of each step.
This sounds annoying to code.
>>
>Global rank: 22
huh, normally I'm 100+
>>
File: p3.png (45 KB, 756x722)
45 KB
45 KB PNG
I won't have time to work on this until later. Here's a graphic in case it helps someone.
>>
File: ec2025-15.png (455 KB, 689x3435)
455 KB
455 KB PNG
unwashed
>>
sooo for part 3, I assume I need to store the walls as ranges now instead of points, that seems easy enough. but how the fuck do i do the pathfinding where there's 6 quadrillion points?
>>
>>107287074
>3.5 hours later
>less than 50 people have completed it globally
you doubted but it's here
>>
holy efffff even part 1 with a manhattan distance a* for weight takes for fricken ever. am I supposed to let this shit run for the entire weekend?
>>
>>107288972
idk my djikstra in python ran in seconds for the bigger part 2 map
>>
File: 1732818528057721.png (54 KB, 684x479)
54 KB
54 KB PNG
Oh thank lord.
>>
>>107289080
hmmm maybe my scoring is bad? I'm just doing distance + manhattan_distance(current position, goal)
>>107289083
wow nice job. I might start counting.... it'd be faster at this rate.
>>
File: carbon.png (884 KB, 1024x4833)
884 KB
884 KB PNG
>>107287902
Sweet baby Jesus on fire, that was a fucking pain.
Have some unwashed ass.
>>
>>107288195
>input isn't in the shape of a duck
why even visualize?
>>
>>107276528
>>107276540

>>107287074
>>107287113

called it
>>
hmm I'm probably filtered even by just part 2. this thing is huge
>>
>>107287902
This works but is more complicated than it needs to be.
Just store all the x-coordinates of all corners and the y-coordinates of all corners. If you sort and deduplicate those coordinates, you get a new grid where you can just step in straight lines and don't have to take into account turns between nodes.
>>
File: 15.png (1.79 MB, 5654x5922)
1.79 MB
1.79 MB PNG
>>
File: ec2025q1p3.jpg (58 KB, 771x426)
58 KB
58 KB JPG
>>107281685
>there's a part 3
didn't even see that
>>
>>107289876
How do you keep track of not running into walls?
>>
File: carbon.png (400 KB, 1024x2170)
400 KB
400 KB PNG
>>107289277
Got around to washing.

It's possible to cull how many line segment collision checks are needed considerably, but it's troublesome and I can't be bothered.
>>
File: 1732442685847891.png (662 KB, 1852x3134)
662 KB
662 KB PNG
>>107290050
Check against walls whenever you actually try making a step.
>>
File: fun drawings.png (41 KB, 1054x539)
41 KB
41 KB PNG
>>107287902
This is basically what I did. I had to head out but "solved it" doodling on an iPad. Now to make it run fast...
>>
File: 15.png (3.01 MB, 1536x1024)
3.01 MB
3.01 MB PNG
Tough day! Thanks for the hints. The corner stuff makes sense. I'll have to try that.
>>
Did anyone actually use that the walls don't intersect each other? Or was him emphasizing that a red herring?
Maybe you could start with a candidate solution that just walks next to the wall, and then refine that iteratively, but this looks more complicated than a more standard algorithm.
>>
File: quest15-1.png (209 KB, 3121x2708)
209 KB
209 KB PNG
>>107289344
Yeah dissapointing. Here's my final visual, showing part1 because for the later stuff it's harder to see what's going on. It looks like it's cheating, but each connection has a viable manhatten route.
>>
Jesus fucking Christ. I had to sleep on that one. I had a solution that worked for part 1 and part 2 but couldn't get the right answer for part 3. But when I woke up I realized what must be the only possible reason for that to be the case, added a loop to check the path at least twice, and boom.
Part 1: 113

Part 2: 3788

Part 3: 486421812


real 0m0,568s
user 0m0,567s
sys 0m0,000s
>>
>>107290765
Yes. It is vital for my solution.
>>
>>107290765
I considered just following corners, and then "pinching off" sections that were obviously redundant or whatever, and also seeing if segments could be 'tightened up' with a sort of simulated annealing algorithm.
I think it would work, but since I had already used Dijkstra's for parts 1 and 2 >>107289277 I kept thinking along those lines until a concrete algorithm popped into my head >>107287902. It's not interesting, but at least it can handle inputs with arbitrarily crisscrossing walls, I guess.
>>
>>107291902
Yoou do use it if you look at corners, because otherwise you wouldn't have any guarantee that a corner isn't in another wall.
>>
File: ec2025-15a.png (282 KB, 579x2114)
282 KB
282 KB PNG
Washed version, which may or may not be more readable
Basically I only checked and moved to "interesting" x and y coordinates, which were all corner x and y coordinates as well as all x-1,x+1 and y-1,y+1 for each of these.
>>
File: EC-15.png (240 KB, 973x1943)
240 KB
240 KB PNG
Fucking finally. Spent all of my time time last night trying to optimise flood fills before actually looking at the input, realising it was impossible and sleeping on it because it was past 1 in the morning. Still wasted ages with stupid bugs this morning until I got it working. Irrevocably messed up my total time, but I'm not filtered yet!
>>
>there are still 30 spots on the global leaderboard for 15 part 3
Grim
>>
>thread turns into a graveyard towards the end of the month
Damn it really is like AoC.
>>
File: carbon.png (519 KB, 1600x2180)
519 KB
519 KB PNG
My solutions? Imported.
>>
>>107293246
someone should try 4 good puzzles instead of 30 bad ones
>>
>>107293288
filtered
>>
>>107293246
To be fair there's only 9 of us left, going by the /g/ leaderboard.
>>
filtered
>>
File: filtered.png (33 KB, 940x470)
33 KB
33 KB PNG
>>107293552
forgot image
>>
>Post solution in the official plebbit thread
>Won't show up when viewed from another IP because my 5 year-old account that I made like 3 innocuous posts about videogames with is apparently shadowbanned for some reason
I hate everything about that site. ESPECIALLY the community.
>>
pumb
>>
Anybody working on creating a bigboy?
>>
I'm def filtered on part 3 so I wanted to see how ai would do with minimal hand-holding. DeepSeek is completely shitting the bed, keeps trying to check point-by-point even after me telling it there are way too many points in the search space for that. Then it gives me solutions that just cross over walls lel
>>
>>107296500
You're so filtered that not even AI can help you
>>
>>107296555
it's kind of validating desu
>>
This thread's almost certainly not going to survive the weekend.
>>
;; lang: clojure
(ns everybody2025.quest2)

(defn add-complex [a b]
(mapv + a b))

(defn mul-complex [[x1 y1] [x2 y2]]
[(- (* x1 x2) (* y1 y2))
(+ (* x1 y2) (* y1 x2))])

(defn div-complex [a b]
(mapv quot a b))

(defn part1 [A]
(loop [i 3, res [0 0]]
(if (zero? i)
res
(recur
(dec i)
(-> (mul-complex res res)
(div-complex [10 10])
(add-complex A))))))

;;;; Part 2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defn engrave? [point]
(loop [i 100, [x y :as res] point]
(cond
(zero? i)
,,, {:point point :res res}
(> (max (abs x) (abs y)) 1000000)
,,, nil
:else
,,, (recur (dec i)
(-> (mul-complex res res)
(div-complex [100000 100000])
(add-complex point))))))

(defn part2 [[Ax Ay]]
(for [x (range Ax (+ Ax 1010) 10)
y (range Ay (+ Ay 1010) 10)
:let [point [x y]]
:when (engrave? point)]
point))

;;; Part 3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defn part3 [[Ax Ay]]
(for [x (range Ax (+ Ax 1001))
y (range Ay (+ Ay 1001))
:let [point [x y]]
:when (engrave? point)]
point))

(assert (= [160508 666932] (part1 [148 53])))
(assert (= 4076 (count (part2 [35300,-64910]))))
(assert (= 406954 (count (part3 [35300,-64910]))))
(assert (= [5 6] (div-complex [10,12] [2,2])))
(assert (= [-3 -2] (div-complex [-11,-12] [3,5])))
(assert (= [0 4] (mul-complex [1,1] [2,2])))


>>107285647
he's right that Eric's writing is much clearer. This guy even makes outright grammar mistakes.
>>
>>107297614
it's survived the previous weekends thoughever
>>
File: Textboard.png (130 KB, 768x1009)
130 KB
130 KB PNG
>>107297781
Anyone remember /prog/ text board? Those were the days.
>>
i guess i have to implement window scrolling on the ps2 to render this output
>>
>>107297614
surprised they did the previous weekends when there was no puzzle, probably should've if not for a couple people intentionally bumping. i'll make a new one like an hour before puzzle drop monday if it does die
>>
30+ hours without a puzzle, how are we holding up?
>>
Well, 11 of us are waiting for the bigboy, and the rest should be kicked out from the leaderboard for being filtered
>>
the mandelbrot set is harder than i thought it would be in mips assembly
>>
File: filtered.png (147 KB, 1880x940)
147 KB
147 KB PNG
>>
pmub
>>
5 MINUTES (+ 24 hours)
>>
File: output-8.jpg (1.82 MB, 2455x2451)
1.82 MB
1.82 MB JPG
Felt cute, mods might delete later.
Input: https://pastebin.com/jaU1WKeV
>>
File: ebcq2.webm (1.23 MB, 599x518)
1.23 MB
1.23 MB WEBM
Finally, all the bugs gone. It's not fast, but now I need to think about how I'm going to render it.
>>
I finally got around to doing part 1 of day 15 and am considering myself filtered. wtf do i do. I bet if I do bfs or A* it isn't going to work with the latter parts.
>>
>>107309190
Instead of considering every point on the grid, use points around corners, outside of the tunnel walls. See >>107290422
>>
File: carbon(13).png (743 KB, 1650x3266)
743 KB
743 KB PNG
>>107309290
Thanks, that did the trick.
>>
>>107287902
I don't know if anyone has mentioned it yet, but you don't even need to use all 4 for this solution. You can get away with just using the one on the outside of the corner.
>>
>dead thread



[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.