this post was submitted on 02 Oct 2023
786 points (98.5% liked)

Programmer Humor

24287 readers
513 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 2 years ago
MODERATORS
 
top 20 comments
sorted by: hot top controversial new old
[–] brophy@lemmy.world 121 points 2 years ago* (last edited 2 years ago)

Kids get infinite registers and no restrictions on stack ordering. Programmers are constrained to solving it with one register and restrictions on stack put operations.

./insert we-are-not-the-same-meme

[–] odium@programming.dev 89 points 2 years ago

It's even called tower of Hanoi because of the Vietnam war flashbacks.

[–] expatriado@lemmy.world 78 points 2 years ago (2 children)

oh, i solved that assignment in school... by finding the algorithm online

[–] Karfkengrumble@lemmings.world 57 points 2 years ago (1 children)

You’re hired, welcome to the team!

[–] ChlorineAddict@lemmy.world 6 points 2 years ago

Bonus points for leveraging the work of others contributing to their success

[–] Anonymousllama@lemmy.world 16 points 2 years ago (1 children)

As it should be, there's way too much reengineering of the wheel. Let the big brains of the past do the heavy lifting

[–] DragonTypeWyvern@literature.cafe 28 points 2 years ago (1 children)

screams in that's not the point

[–] Rodeo@lemmy.ca 3 points 2 years ago

You're right. The learning is the point. So rather than flail in the dark, why not learn the optimal solution?

[–] PapstJL4U@lemmy.world 28 points 2 years ago (2 children)

Before studying CS, I recognized it as 'the bioware puzzle'. They were probably copying their own scribbles fron back then.

Haskell was the hardest, but it looked the most beautiful.

[–] lugal@sopuli.xyz 28 points 2 years ago (2 children)

Haskell was the hardest, but it looked the most beautiful.

That pretty much sums that language up

[–] TheBananaKing@lemmy.world 8 points 2 years ago (1 children)

In order to write a haskell program, you must first write the corresponding haskell program.

[–] lugal@sopuli.xyz 3 points 2 years ago

And in order to do that, you have to imagine sisyphus happy

[–] DarkenLM@artemis.camp 7 points 2 years ago (1 children)

Strange. I find the language hideous, most likely because it resembles math, or maybe because I'm already used to the C-like syntax.

[–] lugal@sopuli.xyz 13 points 2 years ago (1 children)

Haskell is beautiful because it resembles math

[–] xigoi@lemmy.sdf.org 12 points 2 years ago

It's also beautiful because it doesn't have C-like syntax.

[–] Knusper@feddit.de 9 points 2 years ago
hanoi :: Integer -> a -> a -> a -> [(a, a)]
hanoi 0 _ _ _ = []
hanoi n a b c = hanoi (n-1) a c b ++ [(a, b)] ++ hanoi (n-1) c b a

From here: https://www.rosettacode.org/wiki/Towers_of_Hanoi#Haskell

[–] nothacking@discuss.tchncs.de 21 points 2 years ago

Oh but we don't play it, we put lighting into rocks and trick them into doing it.

[–] ArmokGoB@lemmy.dbzer0.com 4 points 2 years ago

Towers of Hanoi? I don't think so.

[–] neonblade@lemmus.org 3 points 2 years ago* (last edited 2 years ago)

Example for stack

[–] stingpie@lemmy.world -2 points 2 years ago

Did you guys find this hard? There are only four possible ways to move a ring, two of which are disallowed by the rules. Out of the remaining two, one of them is simply undoing what you just did.