CS grad thread

CS grad thread.

Dumping my entire collection of the best Sup Forums meme and seeing if anyone has anything new.

Other urls found in this thread:

pastebin.com/raw/hsqba0Pn
games.slashdot.org/story/07/12/06/1312254/EVE-Online-Patch-Makes-XP-Unbootable
twitter.com/NSFWRedditVideo

...

...

...

...

What the hell

...

Sit down let's talk about that Sup Forums watermark.

...

...

...

...

...

...

...

...

...

...

...

...

...

...

All right that's it boys, most are from months ago. Post new stuff!

>CS Grad
At least that's masters

That's retarded

There should be a swap at the beginning if b > a

Most of these are just stupid or unnecessary long implementation but this one can actually cause damage...

>can

...

this is code from yandere simulator
pastebin.com/raw/hsqba0Pn
>if (Yandere.Armed == true && Yandere.Weapon[Yandere.Equipped].Suspicious == true || Yandere.Bloodiness > 0 && Yandere.Paint == false || Yandere.Sanity < 33.333 || Yandere.Attacking == true || Yandere.Struggling == true || Yandere.Dragging == true || Yandere.Lewd == true || Yandere.Laughing == true && Yandere.LaughIntensity > 15 || Private == true && Yandere.Trespassing == true || Teacher == true && Yandere.Trespassing == true || Teacher == true && Yandere.Rummaging == true || StudentID == 1 && Yandere.NearSenpai == true && Yandere.Talking == false)

Wasn't this the pomf.se file name code?

...

2600+ lines of unoptimized and unmaintainable code, crammed together in one method running 60 times per second.

Enjoy.

I wish I had a dollar for every time I accidentally deleted my hard drive like this.

I'm getting triggered because this doesn't follow the original formula for the meme.

Daily reminder that computer science is filled with cucks, gaymurs, "I want to make apps bro" chadlets, man children, idiots in general, poo in the loos, "herro my friend can I see yurr code" chinks, and other degenerates.

what the fuck language is this?

>(float)6
uh

6.0 is not tsundere enough

This one is classic

Java

You have to admire how idiotic that kind of sidestepping of the problem is.

I dont know what the fuck that is but writing 100000 lines of repeating code is not neccessarily a bad thing if by doing that one can avoid usig loops and shit like that. Just write a script to generate repetitive part and then paste it in to your program. It will probably run 20x faster.

>Dunning-Kruger.txt

Isn't that already common compiler practice if a loop needs to repeat a fixed number of times?

>I dont know what the fuck that is

You don't know the school book way of checking if a number is prime?

>he doesn't know what metaprogramming is

How so?

There's no "haha just kidding you okay"

From experience compiles doesnt always detect it, it basicly works on the most basic loops.

what lang is this

ouch

It's not java, java doesn't use "var" or "function".
I'm pretty sure it's javascript.

Definitely not Java. Pretty sure this code is being inputed into Unity and last time I checked, Unity doesn't work with Java. I believe it either works with C#, JavaScript or Boo (whatever that is).
Probably this.

rust

what kind of fukkery is this even ?
what the fuck is this supposed to do ?

oh boy

This one hurts

You can sort of see what they were going for too

Only in the USA, my friend. Only in the USA.

It starts with what looks like hex parsing

It's bad, because it doesn't look that bad at first glance, and even works properly. (Looks random)

...

Holy fuck how can that even be an "accident"?

doesn't java have a parseint with radix?

why not

i=0;
dec=0;
while(str[i]!='\0'){
dec += (str[i++]=='1') ? dec+1 : dec;
}

looks like it was just a single character " "

Why would you calculate the product of a and b without using the product operator?

Even so, why wouldn't your immediate response be a for loop? Some people...

This is C#

No? Use recursion.

games.slashdot.org/story/07/12/06/1312254/EVE-Online-Patch-Makes-XP-Unbootable

The "return 24" made me laugh.

Haha but for what purpose

ooooooooooooorrrrrr
it only says you can't use *

so instead just divide by the reciprocal

a*b = a/(1/b)

>studio.h
I laughed. Good one.

to teach for loops...

It's dumb contrived tasks made by brainless TAs. It doesn't teach you about for loops. Get a real iterative task for that.

it was probably supposed to be a getter but whoever wrote it absentmindedly gave it a parameter

I assume that's more or less how itoa is implemented, tho. Plus some more cases for negatives and whatnot, of course.

I see this kind of shit all the time and it drives me crazy

if (var == true) {
return true;
} else {
return false;
}


Just fucking return var reeeeeeeeeeeeeeeeeee

I love seeing that kind of shit because it lets me know immediately whether or not the person whose code I'm reviewing is a moron or not.
That is to say, whether or not *I* should be reviewing it or if I can hand it off to a jr dev. This has the added benefit of letting me find out which of the fresh hires aren't fucking retards on my team.

nothing wrong there.

Makes sense. I started a new job where this kind of shit happens, though, and trying to correct the code of someone who has a higher status in the company usually comes back with a lot of complaints ("we do it that way around here", etc)

Even K&R's example implementation, which states in the same damn line it explains how it works that it's not accurate for huge negative numbers, is less retarded than that.
/* itoa: convert n to characters in s */
void itoa(int n, char s[])
{
int i, sign;

if ((sign = n) < 0) /* record sign */
n = -n; /* make n positive */
i = 0;
do { /* generate digits in reverse order */
s[i++] = n % 10 + '0'; /* get next digit */
} while ((n /= 10) > 0); /* delete it */
if (sign < 0)
s[i++] = '-';
s[i] = '\0';
reverse(s);
}

gross

It's needlessly verbose. Doing this would be better in most cases:
return var;


And for cases where you can't do that, you could remove the else:
if (var) {
return var;
}
return false;

damn
this is brilliant
and would piss off the prof

almost always as an exercise
but some instruction sets on shit like arduino boards might not even have multiplication built in

Yeah, shorter and nicer. Still, same algo complexity and basically the same idea. The only real improvement is using '0' + n % 10 instead of a case switch. I'd argue that is bad, but there is a hint of reasoning behind it, I have hopes for them -- unlike most of the monstrosities ITT.

>same algo complexity
String var = ""; var = "1" + var;
is NOT the same complexity. Strings are immutable in almost every language, redefining them or using += almost always means you're creating an entirely new variable and having to reassign all of it in memory.
On top of that, using a switch case inside of a while loop is way way less efficient than doing raw logic to get the characters you want.

The case example is something I would expect from a first year student.

>simple!

Oh, yeah, you are right about that. In the K&R the string is preallocated.

The best way to do it in a managed language (that I can think of) is use similar logic to the K&R example, pre-allocate a char[] and then call toString() at the very end, since you cant preallocate empty strings easily.

My other favorite is sorting an array by randomizing it until it's sorted.

Sleepsort is king
while ($_ = shift and @ARGV and !fork);
sleep $_;
print "$_\n";
wait;

it's just tiny typo, have seen shit like this wiping productive environments, not fun

holy shit the `i += 2` is INSIDE the if statement, it will literally never complete

Hell you can just write 6. and it will work

Why the `i += 30030`? I don't understand the loop part

You mean if he had actually managed to return the "random" result, then yes it would look random.

What triggers me isn't the seeding but that fucking modulo bias. Given the right max value and the right application, you could utterly break the application.

That's what you get when you aim to be "inclusive". Fuck you rust and fuck your gay inclusiveness.