this post was submitted on 17 Jul 2023
472 points (97.2% liked)

Programmer Humor

32442 readers
799 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

When your code works, but you don't know how
@programmerhumor

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 5 points 1 year ago (1 children)

these things happened before chatGPT tho.

I once wrote C code for a hangman game. I took in a character and checked if it's matching with any of the hidden characters. Long story short I did not code what should happen when the user inputs more than 1 character, but during testing I realized that it just analyzes every chracter one by one, and if you input the same characters multiple times it would just ignore it ofc. Making it possible to type a single character, multiple if you wanna be risky. Or the whole word. I liked it better than if it would work on a "guess" basis because it was way more fun, so I kept it that way. Have no idea why it does what it did, but it works.

better example is & and * in Rust. If someone tells me they can get them good the first try, TEACH ME, or they are lying. When it works it judt works don't you dare touch them.

[–] [email protected] 1 points 1 year ago (1 children)

I think you basically made a Wordle version of hangman by accident there, lol.

[–] [email protected] 1 points 1 year ago

unexpected crossover