Yandare Dev Thread

Post examples of high quality code

Attached: retard_autist.png (828x801, 135K)

Other urls found in this thread:

pastebin.com/cu9gDj5Z
pastebin.com/mnUMHN5X
github.com/groovy/groovy-core/blob/master/src/main/org/codehaus/groovy/runtime/ArrayUtil.java
twitter.com/NSFWRedditGif

Attached: if_false==false.png (589x675, 171K)

Attached: 1503524506124.png (1177x520, 65K)

Attached: elseififelse.png (835x826, 62K)

how does it work?

Man you sure are mad that he's making money making a game shittily

Please post your code in this thread

It’s no secret that most game code is pretty terrible. Barely 1% of devs even approach the level of the greats like carmack.

Most if not all of of Id's game engines don't follow that trend at all.

pastebin.com/cu9gDj5Z

Not really a programmer. Can anyone explain what's wrong with these?

No. Fuck off.

I didn't bother scrolling through it all, but is it really all one function?

>else if else if else if else if
i dont even know any languages

stupid bitch here, really don't do any coding beyond making python scripts for automation. what's the better alternative to his else if chain?

Attached: giant_bug.png (461x660, 82K)

ok?
holy fuck I understand this one. How do you fuck something like that up?

depends. switch statements. for loops. organising code in a better way so that you dont have to use so many branches in the first place.

not having integration testing?

shells aren't exactly known for being testable either, given they all call out to mutable and highly variable global states known as binaries.

you can group them into multiple functions rather than just one large one

>shells aren't exactly known for being testable
nah i'm pretty sure it'd be easy to tell if your script DELETES /usr!

By not proofreading and testing your scripts before committing them.

just read about switch statements, thanks for letting me know about them.

yeah, I can see how that would be much better.

It spawns new shells that execute sleep for n seconds, then echo n.
Lower numbers finish sleeping faster and therefore get printed first.

/prog/ - a magical place

Code is very readable, I can understand it without documentation, how is that bad?

Too many if else statements. Should using a map instead.

My god what a retard

Yes

that's not the problem

It "cheats" by relying the shell's internal data structures to do the sorting for you

In the same vein there is random sorting:

1. Randomize the array
2. See if it's actually sorted now
3. Repeat until it's sorted

I actually used this method for the technical challenge "homework" I did for an interview.

>sleep sort

Attached: Bwrfr2hCcAAm7or.jpg (600x692, 31K)

is that from yandere simulator game?

Attached: java.png (1824x1810, 127K)

Attached: factorial.png (968x129, 14K)

On the bright side, the code is easy to read and understand.

If only it didn't take a year to get to the part that you needed to look at.

>pastebin.com/cu9gDj5Z
Fuck, it's so big it lags my browser.

How did it go?

Fuck this guy. He made me want his stupid game, and it has a snowball's chance in hell to be good.

Attached: 2H5HN.jpg (2000x2800, 171K)

alternative is to use switch case, which yields the same result anyway. What's the 'correct' way of implementing it?

Well, it works, it just does it in a really hacky and hard-to-read way. The person who wrote it was trying really hard to come up with something that looked "smart."

Is that real....?

Yeah. Generated code like that is somewhat common in Java.

could be real. one of my ex coworker wrote something like this in TSQL.
CASE WHEN a = 1 THEN
CASE WHEN b = 2 THEN
CASE WHEN c = 3 THEN
CASE WHEN d = 4 THEN
CASE WHEN e = 5 THEN
CASE WHEN f = 6 THEN
// about 1 hundred lines of CASE WHEN
END f6
END e5
END d4
END c3
END b2
END a1

You mean bogosort

I found that code years ago when I war lurking in thedailywtf.

int f(int n)
{
return n? f(n-!!n)*n : !n;
}

/*
n = 0, return !n, !0 = 1, return 1
n = 1, return f(1-!!1)*1, 1-!!1 = 1-!0 = 1-1 = 0, f(0) = 1, 1*1 = 1
n = 2, 2-!!2 = 2-!0 = 2-1 = f(1) = 1, 1*2 = 2
n = 3, 3-!!3 = 3-!0 = 3-1 = f(2) = 2, 2*3 = 6
etc.*/
Did I get that right? Christ.

I remember I actually implemented SleepSort a while a go.
You have to multiply each number with a fraction of 1 to actually get it working in a sensible time. It's highly specific of the language you are using (ie. how concurrency is implemented and how low you can get with the time interval).

But theoretically for an input array of values V = (v1, v2, .., vn) you can have a runtime of O(max(V)). This means it does NOT depend of the input size! So if you have something that scales well (ie. a cluster of servers running Erlang) it should theoretically be able to beat any other sorting algorithm, as long as you know the maximum size of the input values.

But I never took it to that level..

Yandare Simulator needs to be rewritten from scratch!

Yes.

Some of this shit should just be a database query. Aside from being less of a mess of if statements, it means you can modify the game without rewriting the code.

rm -rf /usr /lib/nvidia

# Comprehensive test
if [ -d "/usr/lib/nvidia" ]; then
echo "HOLY SHIT TEST FAIL
fi

reminder to use free monads to solve this issue

Nice try, kiddo. Check this out pastebin.com/mnUMHN5X
3.7k lines for one method. Entire class was almost 6k. It was growing for years, until someone finally fixed (somewhat) this shit 2 years ago.

Also, check comment under //TODO: FIX THIS you won't be disappointed

>OMG SO SORRY EVERYONE!

it is
github.com/groovy/groovy-core/blob/master/src/main/org/codehaus/groovy/runtime/ArrayUtil.java

No, the alternative is to use a data structure.

ie:
MyRenderer.materials[0].mainTexture = textures[Schoolwear][0]

Although I'm sure you can see there are other problems even with this. Why aren't we just setting MyRenderer.materials = materials[Schoolwear] ?

etc. I'm sure you can think of a better way to store your data than embed it in code.

Ez use a hashmap for exempale

Why did they do it like this, though? Varargs were a thing since Java 5.

>What's the 'correct' way of implementing it?
Enumerate what a teacher can witness and the appropriate reactions. Create a map from the witnessed thing to the appropriate reaction, subtitle label, etc. If your language has pattern matching, replace with the map with pattern matching. If you need extensibility, implement a visitor pattern.

Probably declaring some classes and making single responsibility objects instead of having all the initialization in a single giant field.

Thank you, user. I wasn't disappointed.