#advent of code
Explore tagged Tumblr posts
ndav1d42 · 5 months ago
Text
holnaptól újra advent of code 👨‍💻
29 ⭐ volt a rekordom, tavaly 12 sikerült (😅😂), hát idén se számítok sokkal többre... 😀
27 notes · View notes
c-official · 4 months ago
Text
Lol. I basicly did todays advent of code manually.
15 notes · View notes
sunless-not-sinless · 5 months ago
Text
advent of code :D day 1
Tumblr media
19 notes · View notes
flyingparrot225 · 5 months ago
Text
Advent of Code - Day 3
This one wasn't as difficult as I expected, especially after doing Day 2 part 2. I expected some kind of curve ball thrown in, like the edge case I talked about in my post for Days 1/2 but one never showed up for my implementation.
That being said, I definitely could have made a simpler implementation by pulling in an external crate (I'm using rust) but I like to try to use just what the language gives me before I do that. Iterators helped a lot but having chains of methods that span 25 lines or more (including multi-line closures) can look quite complicated. I definitely could clean up my code if I tried but at the end of the day, if it works, it works.
8 notes · View notes
transfaguette · 1 year ago
Text
i have just enough programming knowledge for advent of code to be possible but too little for me to know how to do any of it elegantly so I'm just bashing my head against a wall until it works and man I'm having so much fun
29 notes · View notes
upside-down-a · 1 year ago
Text
I'm using advent of code as an excuse to learn haskell, and made this pattern-matching map, which feels slightly abominable.
extractNumeral :: String -> (Maybe Char, String) extractNumeral ('o':'n':'e':xs) = (Just '1', 'e':xs) extractNumeral ('t':'w':'o':xs) = (Just '2', 'o':xs) extractNumeral ('t':'h':'r':'e':'e':xs) = (Just '3', 'e':xs) extractNumeral ('f':'o':'u':'r':xs) = (Just '4', xs) extractNumeral ('f':'i':'v':'e':xs) = (Just '5', 'e':xs) extractNumeral ('s':'i':'x':xs) = (Just '6', xs) extractNumeral ('s':'e':'v':'e':'n':xs) = (Just '7', 'n':xs) extractNumeral ('e':'i':'g':'h':'t':xs) = (Just '8', 't':xs) extractNumeral ('n':'i':'n':'e':xs) = (Just '9', 'e':xs) extractNumeral (x:xs) = if isNumeral x then (Just x, xs) else (Nothing, xs) extractNumeral [] = (Nothing, [])
I don't know if i'm proud or disappointed by this. This feels like it could be done in a smoother fashion, but then again one gotta do some kind of lookup of spelling for letters anyway.
How should I have done this? Also, is there some way to avoid the 's':'p':'e':'l':'l':'i':'n':'g':[] of letters like this?
22 notes · View notes
yetanothertransgirl · 4 months ago
Text
just finished optimising my advent of code solution to go from taking 2 minutes to get halfway through (then crash with an out of memory exception) to completing the whole thing in just 128ms!
honestly feeling very big brain rn
and yes I am telling everyone
4 notes · View notes
ahiijny · 4 months ago
Text
Tumblr media
aoc day 24 be like
3 notes · View notes
zoueriemandzijnopmars · 5 months ago
Text
I have been trying to do Advent of Code this year and mostly I kinda suck (optimising code? Haven’t heard of her) but today was pretty simple to me? I was very scared for part 2 because that one tries to actually kill me usually but part 2 was so simple just a few minor changes?
I guess that perfect mark on Linear Algebra 2 finally paid off???
3 notes · View notes
nicuveo · 5 months ago
Text
Like i've done for a few years, i'm also attempting some days of the advent of code in Brainfuck, because i enjoy the challenge. I've managed to get day 7 part 1 working (kinda...) live on stream.
I used to write detailed explanations of what's going on with all this nonsense on Cohost, but, well, i can't do that anymore... Let me know if y'all would be interested in a written deep-dive on some Brainfuck solutions like this?
https://www.twitch.tv/nicuveo/v/2325296176
4 notes · View notes
bluescreening · 5 months ago
Text
happy fifth of december, i have officially gotten further in advent of code than i ever have before!
2 notes · View notes
c-official · 5 months ago
Text
Advent of code was rough today. Took me 1 hour and 40 minutes...
4 notes · View notes
kafus · 1 year ago
Text
advent of code 2023 day 1
so for the record i'm being pretty casual about this, i have stuff going on this month + my health is wonky as usual so i may not actually be doing this everyday, might do puzzles late, etc
anyway! i'm still a bit of a novice i think, but i decided i would try out this advent of code thing, seemed fun. i'm using html/javascript since that's what i have any experience in right now.
my solutions below the cut so you aren't spoiled if you want to do it yourself!
i decided to keep my part 1 and part 2 solutions separated, they're on the same document. i have some really basic HTML that looks like this:
Tumblr media Tumblr media
and this was my solution for part 1 before words got involved:
Tumblr media
for the record i have taught myself basic RegEx multiple times, and every time i forget nearly everything, so most of my time spent on this solution was refreshing myself on a little bit of RegEx. i think this is pretty straightforward - split the input by line, then loop through each line and remove anything that isn't a number, then take the first and last digit in each of the remaining strings, add them all together for the result.
the solution for part 2 on the other hand:
Tumblr media
i actually found this somewhat frustrating because the problem itself didn't clearly explain whether something like "eightwothree" in the provided example should be "8 2 3" or "8 3"... my original solution disregarded overlapping words like that. this caused issues because if you had something like... i don't know, threeeightwo, my program would make the resulting two digit number 38 instead of 32, resulting in a wrong sum when adding all of them together.
once i realized the issue i was a bit stumped on how to deal with this and get the overlapping words to be included. i knew that i could manually loop through each position in the string, looking for any of the nine digits in either their letter or numeric form, and when it finds a result, push it to an array of results or whatever, but i really didn't want to do that because it would be unnecessarily bulky in my opinion. and i wanted to keep experimenting with RegEx instead. so after some googling i landed on amending the numPattern and changing
lines[i] = lines[i].match(numPattern);
to
lines[i] = Array.from(lines[i].matchAll(numPattern), (x) => x[1]);
and while it works great, i admittedly don't fully understand it. like, conceptually i get its intention and the end result it spits out, but i wish i understood what was happening under the hood with .matchAll() better. i tried to wrap my brain around it, but i'm too hungry and too sick feeling to properly teach myself right now, so i've decided to drop it and if it's still itching at me later, i'll come back when i feel better to understand it.
anyway, after that, still pretty straightforward - once it's taken out all of the numbers in both numeric and written format, it loops through the results and converts the words to digits, then joins all the digits together, then does the same thing as before with slicing off the first and last digit to make two digit numbers and adding them all together at the end with .reduce().
15 notes · View notes
flyingparrot225 · 4 months ago
Text
Advent of Code - Day 20
Today was similar in difficulty to yesterday, though it's similarity to previous days does help me get some practice with the algorithms I've had to learn which is great because that's something I really need.
My solution today takes a solid few seconds which I feel I should be able to improve by changing a few things, but if it works it works.
I honestly didn't expect to get as far as I have, but now that I see the finish line is within reach I really want to finish all of this year's challenges, but knowing my luck I'm going to finish up to day 24 and then day 25 is going to throw in a curve ball that has a really obvious solution that I'm going to miss.
All I can do is wait and see.
6 notes · View notes
typecasto · 1 year ago
Text
Finally got around to figuring out tumblr on desktop now so expect New and Worse Horrors from me in the future. Especially since December (advent of code) is coming up and i love making some cursed ass programs for some of the easier days which i will definitely be showing you (lmk if you want to see the cursed shit i did last year)
6 notes · View notes
twocatsinatrenchcoat · 1 year ago
Text
ehehehe
Tumblr media
3 notes · View notes