this post was submitted on 02 Dec 2026
335 points (96.4% liked)

Programmer Humor

34389 readers
2091 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 3 years ago
MODERATORS
top 36 comments
sorted by: hot top controversial new old
[–] exdor@programming.dev 1 points 5 hours ago
[–] chunes@lemmy.world 40 points 1 day ago

I like this part of Advent of Code's about page:

Should I use AI to solve Advent of Code puzzles? No. If you send a friend to the gym on your behalf, would you expect to get stronger? Advent of Code puzzles are designed to be interesting for humans to solve - no consideration is made for whether AI can or cannot solve a puzzle. If you want practice prompting an AI, there are almost certainly better exercises elsewhere designed with that in mind.

[–] Avicenna@programming.dev 22 points 1 day ago (2 children)

I mean, if you are interested in AI development and what not I understand why you would want to use something like AoC to test your model.

But if you were one of those people who used AI to get a high score in global leader boards by getting a solution in microseconds, then you are just a fuckwad. Not essentially any different from Elon who hired someone else to play online games with his account. Thank you for your attention to this matter.

[–] CameronDev@programming.dev 3 points 10 hours ago

Fortunately, no more global leaderboard, so those losers probably aren't interested anymore

[–] NuclearOatmeal@beige.party 1 points 1 day ago

@Avicenna @cm0002

To be honest, I'm kind of curious as to how that would actually work, but I put in the cranky sleep deprived code. Example being my solution for yesterday. Big ass lookup dictionary for part 2 because it was late.

Maybe I'll try it after I've got all my stars.

A minimized capture of C# code to solve Problem 2 for 2026 Advent of Code. The top is a big lookup dictionary for part 2. Buried at the bottom is a main function, then a couple lines for solution 1, then a slightly bigger version to count all the letters and determine the map. Following is a 1 liner LINQ expression to walk an actual "map".

[–] threeonefour@piefed.ca 84 points 2 days ago (2 children)

I love how easy it is to eat my advent chocolates this year by asking someone else to eat them for me

[–] degen@midwest.social 14 points 2 days ago
[–] vanta@sh.itjust.works 6 points 1 day ago

Calorie free!

[–] Rothe@piefed.social 112 points 2 days ago (2 children)

I love of easy it is to do

...

[–] Carnelian@lemmy.world 49 points 2 days ago (1 children)

At least they didn’t use a prompt to make the post!

[–] 14th_cylon@lemmy.zip 32 points 2 days ago* (last edited 2 days ago) (2 children)

how would you know?

write something funny regarding . include small typo to make it look more human.

[–] Cyber@feddit.uk 15 points 2 days ago (2 children)

🤔 so could your post also be AI?

Hell, am I evne AI?

[–] 14th_cylon@lemmy.zip 5 points 1 day ago

parsejson response bot_debug {prompt:"generate short snarky response"}, {output:"parsejson response err {response:"ERR ChatGPT 4-o Credits Expired"}"}

[–] TrickDacy@lemmy.world 6 points 2 days ago
[–] Clent@lemmy.dbzer0.com 2 points 1 day ago

I’ve actually noticed posts with hints of this elsewhere on the internet.

The errors are atypical of what a human might type and the issues are something a basic autocorrect would have fixed.

[–] boonhet@sopuli.xyz 13 points 2 days ago* (last edited 2 days ago)

This is a group chat, not something super official like a xitter post or something

Probably typed from a phone too

[–] Buddahriffic@lemmy.world 32 points 1 day ago (2 children)

I bet if this guy got one of those word puzzle books, he'd use the answer keys in the back to "solve" the puzzles and then brag about how easy they are.

[–] rtxn@lemmy.world 17 points 1 day ago (1 children)

"Sure, I'll prepare the Christmas dinner" and then just asks his mother to do it for him.

[–] Buddahriffic@lemmy.world 2 points 1 day ago

And later describes the meal as something "we" made if it turned out well or "they" made if it didn't.

[–] FishFace@piefed.social 7 points 1 day ago

I don't think it's meant seriously!

[–] ThunderComplex@lemmy.today 44 points 2 days ago (1 children)

damn, they don't even need the "make no mistakes" anymore?

[–] elvith@feddit.org 15 points 2 days ago (1 children)

Just put that line in MEMORY.md, AGENTS.md and CLAUDE.md

[–] eager_eagle@lemmy.world 2 points 1 day ago (1 children)

I hate this stupid trend of CLUTTER.md

  1. create a .agents/ or something for the trash
  2. uppercase is for humans and to draw attention: neither of which is applicable here
[–] kuberoot@discuss.tchncs.de 1 points 11 hours ago

No, no, it's really useful for me as a human, I can easily spot the file, open it and check the contents, and if it's not just poisoning prompts I know to stay far away from the project!

[–] xthexder@l.sw0.com 11 points 1 day ago (1 children)

I solved day 1 on my phone using a spreadsheet. So far they have been pretty simple. I'm tempted to try solving each day with a different language/system. No AI allowed on my advent train

[–] CameronDev@programming.dev 1 points 11 hours ago

Ive done 3 so far in excel, although day 3 p2 I haven't done. Think I can do day 4pt 1 in excel as well

[–] PineappleProdigy@lemmy.zip 8 points 1 day ago (3 children)

How difficult is this advent of code for a college student that's has been introduced to c, java, js, react, c#? It sounds fun.

[–] CameronDev@programming.dev 1 points 12 hours ago

Check out !advent_of_code@programming.dev , there are solutions in every language possible, and we're all more than willing to lend some brain cells if your struggling.

Very worthwhile, helps expand your programming abilities.

[–] voldage@lemmy.world 5 points 1 day ago

Depends on what "introduced" means, but first 2-3 days usually are easy enough for someone who only recently started learning to get through. The difficulty ramps up, but if you grasp dijkstra algorythm and memoization, you should have most of the tools to clobber together a working solution for most of days, with exception of some more fucked up. It's more of a puzzle that you answer with code rather than a complex coding challenge (for the most part). I've had someone without any IT adjacency describe their way to get a solution for a task after a few hours of head scratching, that a senior web dev I worked with struggled with for over a day. I can recommend, it's very fun, and only you can save those Elves from otherwise guaranteed doom. No shame stopping midway through and picking it up later, though.

[–] dream_weasel@sh.itjust.works 4 points 1 day ago

Some are easy in the beginning. I solved the first couple last year in just vim as a challenge.

[–] pupbiru@aussie.zone 8 points 1 day ago

prompting every day? pft please he needs to build his agentic software factory better so he can slop 365 days per year without even typing

[–] victorz@lemmy.world 13 points 2 days ago (1 children)

Doing this year in OCaml again. It's so freaking great. It's like the language is built for this kind of linear data processing. Loving it.

[–] brennesel@discuss.tchncs.de 7 points 2 days ago (1 children)

I started with awk and then looked into the array based language J. It's crazy how short the code can be.

[–] victorz@lemmy.world 2 points 1 day ago (1 children)

I've seen some J code, yeah, it's pretty freaking terse indeed!

One drawback with extreme terseness I suppose is that if I come back to a program 6 months later, I'm probably not going to understand much at a glance, so to speak. 😅

I'd be excited to see your solutions for this year though!

[–] brennesel@discuss.tchncs.de 2 points 1 day ago* (last edited 1 day ago) (1 children)

That's true. The more concise the solution, the harder it is to understand and remember. Even if you came up with it yourself. That's why I've included explanations for my solutions below.

On Day 1, a list of numbers had to be sorted by how frequently each number appeared. The three most frequent numbers should then be multiplied together.

In awk, this is quite simple:
awk '{s[$1]++}END{for(i in s)print s[i],i}' in | sort -nr | awk -vp=1 'NR<4{p*=$2}END{print p}'
(in is the file containing the numerical values)

• Create an array with the number of values
• Print the number of values and the values themselves
• Sort in descending order by frequency
• Filter the first 3 values
• Multiply them together

In J, it's much easier if you pass the values as a list:
*/3{.(~.\:#/.~) in

• #/.~ displays the frequency of the numbers
• ~. displays a list of the different values
• \: sorts the values in the list on the right in descending order and displays the values from the list on the left
• 3{. takes the first 3 elements of the list
• */ multiplies all elements of the list

Part 2 of Day 1 is trivial, since you just need to reverse the sorting order.
So use sort -n instead of sort -nr for the awk solution, and /: instead of \: for the J solution.

Day 2 is already a tiny bit more interesting. The task was to calculate the distance for a defined sequence of colors.

Here's how I solved it in awk:
echo "groovyyoyo" | fold -w1 | awk -vl=1 '{i=index("roygbv",$1);s+=(i-l+5)%6+1;l=i}END{print s}'

• For line-by-line processing in awk, the string is split into lines using fold -w1
• Determine the index of the current character
• Subtract the distance from the last character (l starts at 1)
• Modulo 6 accounts for the fact that the sequence starts with r again after v; adding 5 prevents negative values
• Add 1 at the end so that the values range from 1 to 6 instead of 0 to 5
• All values are added up continuously, and the sum is printed at the end

In J, the same algorithm can be used and looks like this:
+/1+6|5+(}.-}:)0,'roygbv'i. in

• 'roygbv' i. determines the index (starting at 0)
• 0, adds the initial value 0 to the front
• (}.-}:) is the difference between two consecutive list elements
• 5+ adds 5 to each element
• 6| calculates modulo 6 for each element
• 1+ adds 1 to each element
• +/ sums all elements

Part 2 has the greatest potential for optimization so far. The goal is to get the greatest possible distance.

First, I counted how often each letter appeared and subtracted the distance only at the transitions between colors:
echo "roygbv" | fold -w1 | awk -vl=1 '{x[index("rvbgyo",$1)]++}END{for(i in x){s+=(6*x[i]-i+l);l=i}print s}'

• In the array, I counted how often each letter appears
• One trick is that I get the distance directly by reversing the list of color values and using the index
• Then I take advantage of the fact that the for loop outputs the indices in ascending order, so that I can start with r for the longest distance and then work through the colors from the end
• For each color, I calculate the number count * 6 minus the distance to the previous color to determine the color transitions
• Finally, print the sum

Then I realized that, in the end, it doesn't matter at all how many different colors there are. The only thing that matters is which one is farthest from r. So you just need to subtract that maximum distance, and otherwise you can always assume a distance of 6 for each element.

That makes it even easier:
echo "groovyyoyo" | fold -w1 | awk '{i=index("rvbgyo",$1)-1;m=i>m?i:m}END{print 6*NR-m}'

• m=i>m?i:m determines the maximum index (starting at 0)
• 6 * NR - m calculates 6 times the number of numbers in the list minus the maximum distance from r

The same procedure is even shorter in J:
((6*#)-[:>./'rvbgyo'&i.) in
• >./ determines the maximum index
• [: in J ensures that the function on the left-hand side receives the same input, i.e. the number list
• 6*# determines the number of elements in the list and multiplies it by 6
• Finally, the difference between the two values is calculated

I can hardly imagine a shorter solution.

But now I'm curious how your solutions look like in OCaml.

[–] CameronDev@programming.dev 1 points 11 hours ago

!advent_of_code@programming.dev we have solutions threads, you're welcome to share yours there as well