297
Infallible Code (feddit.uk)
submitted 1 week ago by [email protected] to c/[email protected]
top 50 comments
sorted by: hot top new old
[-] [email protected] 102 points 1 week ago

You don't get it. This was made in GameMaker Studio 1.4, which doesn't support a modulo operator. You know nothing about this specific framework. I have 8 years of experience and hacked governments. There's no reason to update it now, because it runs on a smart fridge at maximum capacity.

[-] [email protected] 56 points 1 week ago

I worked at Blizzard. I worked at Blizzard. I worked at Blizzard.

[-] [email protected] 14 points 1 week ago

Yeah, but did your dad work at Blizzard??

[-] [email protected] 18 points 1 week ago

I’m the first ever second generation Blizzard employee!

[-] [email protected] 2 points 6 days ago

This is such an unhinged thing to say, it had me rolling.

[-] [email protected] 91 points 1 week ago

You could save about half the code by only listing one boolean value and having the other as a default return at the bottom.

Sometimes my genius is almost frightening.

[-] [email protected] 19 points 1 week ago* (last edited 1 week ago)
[-] [email protected] 2 points 6 days ago

That and all negative values

[-] [email protected] 1 points 6 days ago

Patience guys, I'm sure they'll get to supporting zero and negative integers as soon as they finish all positive integers

[-] [email protected] 5 points 1 week ago

But this way your buddy in QA can build extra test cases and pay you back when he wins an award for most test cases created or some other corporate nonsense.

load more comments (1 replies)
[-] [email protected] 88 points 1 week ago* (last edited 1 week ago)

After working at blizzard for 51 years, I finally found an elegant solution by using the power of recursion

private bool IsEven(int number){
  if (number > 1) return IsEven(number - 2);
  if (number == 0) return true;
  if (number == 1) return false;
}
[-] [email protected] 41 points 1 week ago
[-] [email protected] 14 points 1 week ago

Now see, you need the other method. IsNegativeEven()

[-] [email protected] 9 points 6 days ago

We can avoid expensive branches (gasp) by using some bitwise arithmetic to achieve the so-called "absolute value", an advanced hacker technique I learnt at Blizzard. Also unlike c, c# is not enlightened enough to understand that my code is perfect so it complains about "not all code paths returning a value".

private bool IsEven(int number)
{
    number *= 1 - 2*(int)(((uint)number & 2147483648) >> 31);
    if (number > 1) return IsEven(number - 2);
    if (number == 0) return true;
    if (number == 1) return false;
    throw new Exception();
}
[-] [email protected] 2 points 5 days ago

Nice, now we just need another function to find odd numbers, cause not all numbers are even you know.

[-] [email protected] 13 points 1 week ago

I removed the tail recursion for you:

private book IsEven(int number) {
    if(number > 1) return IsEven(number - 2) == true;
    if(number == 0) return true; 
    if(number == 2) return false;
}
[-] [email protected] 3 points 6 days ago

What'd be the result for IsEven(1)?

[-] [email protected] 5 points 6 days ago

Stack overflow

load more comments (2 replies)
[-] [email protected] 26 points 1 week ago

At least this madness is isolated to this function. It can easily be fixed.

Pirate’s code is just cluttered with magic numbers everywhere. Hard coded numbers that are referring to a big ”story array”, or characters. It’s just a giant web of complexity. The only fix is to start from scratch.

[-] [email protected] 4 points 1 week ago

It's simple. The only problem is that your code sucks!

[-] [email protected] 24 points 1 week ago

This isn’t his actual code, right? Like this specific code pictured here? I’m aware of the “drama” surrounding him currently.

[-] [email protected] 66 points 1 week ago

Nah.

Someone added him to an existing meme.

But, if this was his code he would defend it and condescendingly tell you that he is correct, you are not knowledgeable enough to understand and let you know he worked at Blizzard for seven years.

[-] [email protected] 27 points 1 week ago

Did you know that he worked for Blizzard for seven years? Not only that, but he was Blizzard's first second-generation employee. He grew up in Blizzard. An extreme accomplishment to be certain. Thank you based and blizzpilled Pirate Software.

I wonder if he was the one stealing the breast milk. After all, I've heard he can be really childish.

[-] [email protected] 3 points 6 days ago

The funniest thing about his blizzard obsession and the fact that his dad is like a first generation blizzard employee is such a weird glex these days.

So, did you get to harass any women yourself, or did you get your dad watch doing it? Were you a high enough employee that they gave you the Bill Cosby room to rape someone?

[-] [email protected] 7 points 1 week ago

Second gen blizzard employee

[-] [email protected] 14 points 1 week ago

this is an old meme about yanderedev

[-] [email protected] 17 points 1 week ago

Inaccurate, it should be return 1 and return 0 for the true 20 years at Blizzard quality.

[-] [email protected] 13 points 1 week ago

Even plus even equals even.

Odd plus odd equals even.

Only odd plus even makes an odd.

Are there twice as many even numbers as there are odd numbers?

[-] [email protected] 7 points 6 days ago

Even plus even

Odd plus odd

Even plus odd

Odd plus even

[-] [email protected] 1 points 6 days ago

Are we working with a non-abelian group? Other wise this would work.

[-] [email protected] 12 points 1 week ago

Pah, mathematicians and their generally applicable pure approach to solutions and fancy modulus operations, who needs 'em? Computing is applied and we always work with well-defined finite precision. Granted, writing the boilerplate for all possible 64 bit integers is a bit laborious, but we're programmers! That's what code generation is for.

[-] [email protected] 2 points 6 days ago

You can generate the code with a simple macro.

[-] [email protected] 4 points 1 week ago

If it works it works. You mathematicians just don't understand the pragmatics. What is tech debt?

load more comments (2 replies)
[-] [email protected] 11 points 1 week ago

Better/fastest approch would be to check the last bit of the int and return the result. Second use modulo.

This? Dev should burn in hell. Who created this?

[-] [email protected] 12 points 1 week ago

Alternatively you can divide by 2, turn it into an int, mtiply it by 2 and check if both numbers are the same.

[-] [email protected] 5 points 1 week ago* (last edited 1 week ago)

or another stupid, but viable way to do it,

if number = 0:

return true

runloop = true

while runloop:

if number > 0:

number -= 2

else:

number += 2

if number = 1:

return false

runloop = false

if number = 2:

return true

runloop = false

still very shitty amature coding, doesn't depend on modulos, or anything that I can think of that some languages might lack an equivelant of.

[-] [email protected] 5 points 1 week ago

Yandere Simulator Dev. Spaghetti code throughout

[-] [email protected] 8 points 1 week ago

The fact that this probably doesn't even optimize to a lookup table just gives me pain.

[-] [email protected] 8 points 1 week ago
[-] [email protected] 3 points 1 week ago
[-] [email protected] 4 points 6 days ago

Okay so basically this is saving bytes on a technicality but also good programming language design (for this specific purpose).

The first aspect is that since you're scored on bytes, it's not really to your advantage to use a language that uses ascii (or utf-8) for it's tokens, because a large part of it is unprintables like DEL or BELL. So people have designed specially crafted golfing programming languages that use a full 256 possible characters in order to pack as many features as possible in as few bytes as possible.

The good design part of it is that if you really think about it hard, there's really not that many things you expect a programming language to do. It turns out that 256 total different operands is about in the sweet spot, so each character that's available in the 1-byte code page is mapped to one command, and the languages are also designed to make as many things as possible implicit, both at the cost of readability. Remember, all that matters here is getting the lowest score, not code maintainability or anything else.

This leads to languages like japt (which is a terse form of JavaScript, I'm pretty sure) or pyth (same for python) or Vyxal (my personal favorite, used to be python based but is now bespoke) that look like this but absolutely own at getting a task out in as few bytes as possible.

[-] [email protected] 7 points 1 week ago

I pretty much did this at my first coding job lol I was building an online menu that you flip through with the keys lol

[-] [email protected] 9 points 1 week ago

I did his "optimized" shading trick for a game my friends and I built for a coding project in school.

Because the project was due in three hours and we realized that we didn't have any menus. So it was a matter of getting anything functional as menus(stage selection, button mapping, main menu.)
So the game itself capped at 60fps on the potato school computers, but the static menus only got 20fps.

[-] [email protected] 7 points 1 week ago

Lol the amount of bullying this guy is getting lately. I've seen similar spins and bends that looks somewhat legit, making people believe he suck at coding

[-] [email protected] 5 points 1 week ago
load more comments (1 replies)
[-] [email protected] 5 points 1 week ago

Then again, Duff’s Device works rather similarly.

[-] [email protected] 3 points 1 week ago

Try coding chess next time

See ya in a few years

[-] [email protected] 3 points 1 week ago

Not to take from all the funny answers ... but

bool IsEven(int i) => (i & 1) != 1;

(C#)

load more comments (2 replies)
load more comments
view more: next ›
this post was submitted on 15 Jul 2025
297 points (100.0% liked)

Programmer Humor

25170 readers
1634 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