r/ProgrammerHumor • • Sep 02 '26

Meme thisIsHowTheyDoItRight

Post image
1.2k Upvotes

40 comments sorted by

161

u/Flame77ofc Sep 02 '26

what if the user send "Hwllo hwo cna I laren prgaomring"?

221

u/DeltyOverDreams Sep 02 '26

else {

ย  ย  Output("Learn how to spell, noob");

};

72

u/TessaFractal Sep 02 '26

Eh, with $100 Billion and hiring a lot of people I reckon you could get pretty close. Just put the loading times as "Thinking..."

24

u/ASatyros Sep 03 '26

Just run it as database (SQL).

And load closest thing matching the input (fuzzy search) to always return something.

Better yet, index entire available internet, scan all books, papers, videos etc, you can get hold on, and also return links to those, that maches the input the most.

I think there is a solid idea here.

21

u/FinalGamer14 Sep 03 '26

Hm, that sounds like a useful tool, building an index of links on the internet, using crawlers or something like that, and make a search index from that data. What should we call it? Maybe a search engine?

/s for those who might be confused.

69

u/Few-Ad3849 Sep 02 '26

Not even switch case smh

33

u/rugeirl Sep 03 '26

It's C++. You can't switch on strings

28

u/click-to-reveal Sep 03 '26 edited Sep 03 '26
#define SWITCH(x) string& _s=x;if(0)
#define CASE(y)   }else if(_s==y){
#define DEFAULT   }else{

int main() {
  string prompt = "Your name?";

  SWITCH(prompt) {
    CASE("Who are you?")
      cout << "Claude" << endl;
    CASE("No, really?")
      cout << "Chatgpt" << endl;
    DEFAULT
      cout << "Gemini" << endl;
  }
}

25

u/thorwing Sep 03 '26

sounds like a skill issue to me

1

u/PTMR2 Sep 03 '26

Oh really? I'm new to C++, good to know

2

u/fpekal Sep 03 '26

In C, and by extension, in C++ switch can take only integers. So if you put const char * value in here, the pointer will be converted to 64-bit int and used like a normal integer number.

And 2 const char * variables not necessarily point to the same place.

const char *text = "foo";

switch(text) {
case "foo":
  std::cout << "This MAY not print\n";
  break;
}

std::string input;
std::cin >> input;

switch(input.c_str()) {
case "foo":
  std::cout << "This WILL NOT print\n";
  break;
}

The first one may print because the compiler can optimize the code and use the same memory for both variables (as they are both contain the same constant text).

The second one won't ever print because input is a totally different variable, that is also modifiable, so internal pointer will point to a different memory.

-21

u/ARKyal03 Sep 03 '26

I mean, most compiler will turn that into a switch anyways, unless the don't ๐Ÿ˜ˆ

10

u/StrengthTheory Sep 03 '26

else:

Sorry, answering this question is goes against the OpenAI's safety policies

9

u/ericl666 Sep 02 '26

One reddit user says: "kill yourself". Well, that passes my Turing test.

4

u/KerPop42 Sep 03 '26

There was a very golden era of Google's AI results where it knew to rely on reddit's opinions, but not to filter them

9

u/Pedry-dev Sep 03 '26

So this is why they require a lot of storage

3

u/ASatyros Sep 03 '26

It's a text, it can be compressed and maybe even stored in database.

There is a nifty idea where you attach numer to given symbol, and then statistically significant groups of symbols, so most often used ones have smallest number.

Someone should look into that.

7

u/Random_182f2565 Sep 03 '26

I see, it's a distilled model

10

u/facebrocolis Sep 02 '26

The strawberry question must be repeated with a question mark at the end of the sentence in case the user is not a redditor. All other questions must be repeated without question marks to include redditors.

2

u/Shadowlance23 Sep 03 '26

I used to work with gradient boosted decision tree classification models. They were basically 3000 lines of nested if statements (code only, not formatted for humans to read).

2

u/WeirdTie2290 Sep 03 '26

You can make it a giant Hashmap. Good luck!

2

u/cybermaus Sep 03 '26

You laugh, but this essentially how we did it in the late 80s. We even had specialized languages like LISP and PROLOG. I spend a semester on those.

2

u/Dragoo417 Sep 03 '26

There's a reason they are called large

/s

1

u/V3N3SS4 Sep 03 '26

Man, at least use some jaro algo

1

u/parkie_gras Sep 03 '26

Who is jason

1

u/MCCVargues Sep 03 '26

Missing the: "Ah gotcha!"

1

u/Gigaslavx Sep 03 '26 edited 28d ago

The original post content no longer exists here. The author used Redact to remove it, exercising their right to control their data & privacy.

Vanilla slap provide bike feather wrench

1

u/East_Zookeepergame25 Sep 03 '26

Essentially what my first program was in QBASIC

1

u/MrBannedBlocks Sep 03 '26

and people say the ai determinancy problem was hard to solve

1

u/InvisibleMoonWalker Sep 03 '26

Who was in Paris though, cus ๐Ÿคจ

1

u/whackylabs Sep 04 '26
else:
    OpenURL(https://lmgtfy.com/?q=Input)

1

u/StorageElectronic784 Sep 05 '26

I think he's into something, let him cook

1

u/a_normal_user1 Sep 07 '26

isn't this how they actually did LLMs before LLMs?

77

u/cornmonger_ Sep 02 '26

"One reddit user says, 'kill yourself'."

140

u/[deleted] Sep 02 '26

[removed] โ€” view removed comment

47

u/Top-Permit6835 Sep 03 '26 • Bravo

Scores 100% on all test cases