this post was submitted on 01 Jun 2026
436 points (98.9% liked)

Programmer Humor

31673 readers
1806 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 25 comments
sorted by: hot top controversial new old
[–] PapstJL4U@lemmy.world 2 points 2 days ago

The bioware puzzle. I solved it in Kotor, jade empire and mass effect before the algo course came

[–] MoonMelon@lemmy.ml 77 points 4 days ago (2 children)

Actually one of my most favorite memories because the simplicity of the solution using recursion blew my little mind. It was like discovering a magic spell.

[–] Corbin@programming.dev 23 points 4 days ago

I remember learning recursion twice: once for Fibonacci and once for Hanoi. It did take a while to click but it unlocked recursion schemes and dynamic programming.

[–] Gonzako@lemmy.world 9 points 4 days ago

To me it was an example that there are some problems only solved by recursion but that they also overblown in their relevancy

[–] bignose@programming.dev 33 points 4 days ago* (last edited 4 days ago) (1 children)

A child of five would understand this. Fetch me a child of five.

—Groucho Marx

[–] kunaltyagi@programming.dev 4 points 4 days ago

Caxhe poisoned. By the time next child of 5 is brought, child turns 65 years old

[–] Australis13@fedia.io 32 points 4 days ago (4 children)

The Tower of Hanoi is just a game for children?

I don't think most people would manage the optimal solution first go (1023 moves for a 10-piece game).

[–] Tartas1995@discuss.tchncs.de 8 points 4 days ago (2 children)

Most people? 100% not. Me who has probably autism and has internalised the algorithm, I can.

I love and hate my brain.

[–] orwellianlocksmith@lemmy.world 4 points 4 days ago (1 children)
[–] Naz@sh.itjust.works 2 points 4 days ago (1 children)

I thought I was clever, it took me 300 moves with only 8 disks.

Literally just easier to pick up the entire pile and move it over, or rotate the entire game and say Tower #1 is Tower #3 now.

[–] Tartas1995@discuss.tchncs.de 3 points 4 days ago (1 children)

The thing is... not doing it at all, is better than doing those 300 moves. What made you do this? Also a bit spicy?

[–] Naz@sh.itjust.works 2 points 4 days ago (1 children)

I was sliding it back and forth as fast as I could, because I didn't understand the puzzle at first, but then I saw there's an sorting optimization puzzle and thought that I was clever only to find out it's tedium.

Halfway through (or so I thought at move 80), I was just curious to see how ridiculously long the puzzle could be, shifting pieces back and forth

So the answer was: I thought the puzzle was easy, and I was humbled, and stubborn.

I solved it and wasted time, and used that time to warn others to not bother with the puzzle

[–] Tartas1995@discuss.tchncs.de 1 points 4 days ago

I can respect that. Focused, determined, protective!

I thought it was fun...

[–] SpaceNoodle@lemmy.world 8 points 4 days ago (1 children)

Determining the correct algorithm is a game for children

[–] Kazumara@discuss.tchncs.de 3 points 4 days ago

Once you have it figured out, just mechanically doing it all correctly for 1023 steps is also annoying.

I did it up to the 511 moves for the 9-pice game on Android once, and according to the stats page that took me 6 min 18 seconds. The 10-piece version does not have a time, so I think I gave up :-)

[–] Siethron@lemmy.world 2 points 4 days ago

Well the children don't have to move one piece at a time, they just take all the rings off then put them on in the right order. So the optimal moves for a child is 4.

[–] MonkderVierte@lemmy.zip 13 points 4 days ago

Adding a cache is the elegant solution here.

[–] ranzispa@mander.xyz 8 points 4 days ago

I have some code rotting somewhere in a repository where I was doing several moves to organise some stuff.

Ages after I wrote I realised it was basically this problem and a standard algorithm could apply.

[–] unmagical@lemmy.ml 8 points 4 days ago (1 children)

Source tower has odd disks? Move top piece to destination tower. Otherwise, move it to the top of the off tower. Always move the largest disk you can that wasn't placed in your previous move.

[–] SpaceNoodle@lemmy.world 3 points 4 days ago* (last edited 4 days ago) (1 children)

These instructions seem incomplete.

Consider a tower of three, moving from the left to right:

321 / - / -

32 / - / 1

3 / 2 / 1

Next, 1 should be moved to the center position on top of two for the optimal solution, but your ruleset has no indicator of which choice should be made.

[–] unmagical@lemmy.ml 2 points 4 days ago (1 children)

You're right, how can we simplify that into a usable insite?

Prioritize erecting "neat" towers then moving the largest disk not placed in the previous step?

[–] SpaceNoodle@lemmy.world 2 points 4 days ago

For each tower of size N, move tower (N - 1) to the non-target position, then move the base to the target position, then move the previously moved tower of size (N - 1) to the target position.

[–] TomMasz@piefed.social 1 points 4 days ago

The book I used to learn Pascal back in the day had this as the example for recursion.