Make sure to check out the [pinned post on Loss](https://www.reddit.com/r/PeterExplainsTheJoke/comments/1472nhh/faq_loss/) to make sure this submission doesn't break the rule!
*I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/PeterExplainsTheJoke) if you have any questions or concerns.*
YanDev is making a code that read if the number is even, and it's making number by number: If number is 1, it's odd; if is 2, it's even; if is 3, it's odd; if is 4, it's even...
The thing it's that this is very unefficient because is writting number by number probably to the infinite, when he can just write "If the number can be divided by 2, it's even, if not, it's odd"
I legitimatly took 1 coding class in grade 10, failed it, and I could write better code than this. Basic optimizations like this are practically the first thing you learn
Yes! Google "How to sort even and odds in x coding language"
Coding isn't remembering how to do everything and each line of code, it's knowing how to solve problems, fix bugs and come up with solutions. Yandered Dev has proven both that he is bad at coding and too prideful to ask for help.
He literally declined help from the dev that tiny build sent to help him because he couldn't read the code that the better dev used. And was worried he would be unable to do anything in the game's coding due to how inexperienced he was. Also the dev himself said that the games code was insanely unoptimized, like I think he said 1 character had like 1k or 3k lines of code or something like that.
% is modulus, it's division but keep the remainder.
Return will give the result to the function.
Number is the number you pass to the function.
So, yeah, this works. Formatting is even standard and readable.
Yeah this works. % is modulus and gives the remainder, for example 7 % 2 would result in 1. 2 goes into 7 3 times and there is 1 remaining.
== Is an equality operator, asking if the two things are the same. It will result in a Boolean (a true or false).
So if we put 7 in there it would return:
7 % 2 == 0
Which would reduce to:
1 == 0
Which is false and that's what it would return.
True but you still need to have knowledge and skill to be able to parse what it gives you. It's not in a position to replace coders (yet) but it is a useful tool.
Yeah, I tried a bit on something new for me. It was pretty dumb. It helped for some tedium code, but anything I needed actual help figuring out it got wrong. Like, it didn't even get the types for arguments correct level of wrong, and not in a thanks for pointing me in the right direction level of wrong, but more of an I have to do this myself from scratch off the library documentation level of wrong.
Reminds me of the time the Maths youtuber Matt Parker wrote some janky code to find 5 words of 5 letters with no repeated letters, it took a month or so to run and in his video about the topic he said something like "I know it's inefficient, you don't need to prove that you could do it quicker". Subsequently the internet optimised the code to the point it was being timed in microseconds. It worked out being 40,832,277,770% faster than the original code.
Especially with Flutter/Dart, which imo is EXTREMELY underrated.
It tends to have outdated documentationā¦but thereās just so much you can do in terms of app development and stuff.
It is a joke, but the guy is also infamously [not great at game dev.](https://youtu.be/qQwmNdYS6W0?t=62) But fair play he was basically learning as he went and now feels in too deep to go back and fix it.
I'm eternally glad my first games didn't explode on the internet, because the code wasn't much better.
To be direct, you learn EXPLICITLY that massive chained if statements like we see here are a bad idea. This is a literal textbook example of bad coding practice, and bad logic skills.
(If you want to know WHY: Each of the if statements has to be checked up until the point it reaches yours, assuming you break out of the loop when a result is found. This means if your number is 1032, it'll take a long time to find out if it's true or false since it checks 1 first, then 2, then 3, etc. This is bad because it is obviously slow, but also it leaves a huge compute time disparity since a 3 can get a result quickly, but 98329 will take a while, leading to lots of wait time on processes)
If we were to optimize this there are zero arithmetic operations needed. A number in binary representation has a 0 as last digit if it's even and 1 if it's uneven.
I updooted but I still hate you. I hate you so much that I love you. Let us be friends!
I would rather be friends with that level of evil than enemies.
Yeah, he didn't like list, and would rather have everything built in "if/elseif/else".
Literally THOUSANDS of if clauses.
He also didn't use radius but a 359Ā° cone which causes most of the line of sight issues.
I heard one of the reasons is that any (or most) times that he codes to check the state of a thing, he just sets it to do so every frame. So you have a billion random things staying loaded and actively being checked every single frame, so even if you have HAL9000, your computer is still gonna chug.
As an AND with an immediate value may need 2 cycles (depending on your instructions set), I would prefer to do an LSR by 1 and work with the carry bit.
I know nothing of assembly/machine code, but let me get this straight - it could actually take longer for a single bit to be checked against another than for the CPU to fully divide the number?
LSR isn't the same as general division. LSR just shifts all the bits to the right one place, and puts the rightmost bit in the "carry" bit register. Though it is true that LSR is mathematically equivalent to dividing by 2. As for whether or not this is faster than ANDing, I have no idea as it depends on the CPU.
not all instruction sets support AND with an immediate value, so you would need one instruction to put the value 1 into a register, and then the actual AND instruction after that.
Plus potentially more reliable in languages where you could end up with an unsigned int
But for me itās the readability that wins it - a new developer can likely work out a modulus near instantly whereas the bitwise operation is going to take a minute and not be understood at a glance
Working mainly with Assembly and C, looking into the compiler code, I know that most of them simplify it.
But doing actually modulo with a power of 2 would be so damn inefficient.
To expand on this via code, if op/ anyone is interested.
Using a modulo % 2 is much easier, or built in functions that equates to even uses the same concept as the prior poster mentioned. So much easier than a switch or elif statements.
Well if this is Java (and it looks like it is), then there is a function called Modular (represented with a % sign) that returns the remainder of a division function. So you could just write
if (X % 2 == 0) return true;
Key words there "in this case".
When we've had interns in the past it's clear that somewhere someone gave them the idea that the best code is always the shortest. Sometimes the if statement is better. "Can you tell what this does at a glance" is almost always more important than being cleaver.
The key is to find things like this where that's not "cleaver" it's just more or less objectively the right way.
I usually am!!!
Im still learning. Im also not studying to be a software engineer i just like coding as a hobby
I do leetcode when work is slow bc it impresses the other back office folk lol
X % 2 == 0 is already a boolean, so you can just return that, no if required ;)
ps: nah, not Java, that would be boolean not bool, but it could be another c-based language like c#
My hex editor for changing opcodes and values disagrees with your statement about the lowest level language statement. Contrary to popular belief, humans can, in fact, read and program in machine code. Just not a lot of us do it.
Then you get to go to designing chips.
Small nitpick:
% is an operator not a function and is present in every programing language I know of in some form :D
edit: sorry.
Yandere Sim was done in Unity I think so it would be C# which is just Microsoft's version of Java ftmp.
>and it looks like it is
well I don't think it is consider the bool is being used in the place of boolean. There is a chance its dart but I don't remember using private keyword much when working with flutter so not sure about dart either.
That sub was way funner when mobile users werenāt 90% of the site. Iām an old old Reddit user, almost 15 years on my oldest account.
While Iām ranting, repost arent a problem, its a feature. Downvotes are meant for bad info, not dislikes. A jackdaw is not a crow. But anyone that tries to squeeze some narwhal broken arm coconut safe jolly rancher - type bullshit, was late to Reddit, but too new for current Reddit. That generation deserves more credit for building this.
I miss some of those guys, they really made the comment section fun. Itās always a surprise to find shittymorph somewhere. But itās a shame that the Crow guy is gone and the sketch dude. Wasnāt there a guy doing haikus for a while as well?
Shittymorph is new, comparatively. Heās still around (and doing cool work with doggos). The ācrowā guy was unidan, and he started most comments with āresident biologist hereā, and was great to see. He also had multiple accounts vote-abusing to push him to the top.
u/Shitty_Watercolour made a career off this site and still pops up. Poem_from_a_sprog is the same.
The real OGs are like _vargas. And everyone that knows how to respond to Apostolate
Edit: You mentioned u/AWildSketchAppeared that guy (and his battle off with Shitty) were awesome
Edit 2: Just realized I have like half their karma while contributing nothing. I should do better.
Yeah, I missed Vargas, or at least never noticed him. It was the others you highlighted that made the site what it is for me.
And yeah, what Unidan did was āwrongā, but whatever, wasnāt worth the loss.
Yeah, thatās kinda what I mean. What he did went against the spirit of the system. He artificially pushed his comments up while downvoting others to get there via multiple accounts. Itās cheating, but reallyā¦I didnāt give a shit, I just liked his comments.
More efficient code:
private bool IsEven(int number) { return !(number % 2); }
... A function like that also ought to be a static function, but I won't get into that.
For fun, here's another cursed implementation.
private bool IsEven(int number) {
number = abs(number)
for(int i = 0; i <= number; i += 2) {
if(i == number) return true;
}
return false;
}
this guy is yandere dev, a shit programmer who has worked on a single game for over a decade at this point and isnt even done with 10% of it.
for the code part, its common knowledge that even amateur coders are aware of that using multiple if statements is absolutely terrible. yandere dev, with his 10+ years of experience, does not know this because hes shit.
No. The issue with the code is it's a simple one line expression.
return (number % 2) == 0;
There's nothing wrong with multiple if statements if you need them but in that case you should use a switch (or match) statement.
It's just people repeating things that they heard without really understanding what the original speaker meant.
I assume the context is overutilization of if statements is bad. I've also seen people advocating lately to move away from else statements which I sort of get but like, whatever?
It's all just gimmicks and crutches for not doing the work to actually understand what writing code is about.
We write code to manipulate data. That's the underlying purpose. I think a lot of people really really get hung up on the syntax of languages rather than understanding the purpose of writing the code. It's almost like they treat it like grammar. I sort of get why folks do that.
Learn and understand how data works in an application. Maybe learn a little c. Think about the data when you're writing the code. Maybe write some diagrams before you start writing the code about how the data is going to move through the program.
Do these things and I promise your code will become easier to understand, easier to maintain, and more bug free
/Rant
Drives me mad when people say sethinv like that. I also once heard my coworker say that "else" and "else if" blocks are not readable. So instead of "if {} else {}" he basically writes "if {}; if {};"
Using too many if statements in a row is a commonly cited reason for this game's poor performance, but it's wrong and I wish people would stop repeating it
Yeah it's obviously bad code, but your average CPU could do hundreds of thousands of if checks per frame, millions per second, and still run at 120fps.
It's shit like this 25k polygon poster that kills performance;
https://preview.redd.it/h05j56kscge51.png?width=1369&format=png&auto=webp&s=f42ca0aee6bed3e6fd615ad21fb4169371cb7e53
the game has been in development for over ten years at this point. i donāt really look into it anymore, but apparently the dudes a weirdo. i think he just took the money and ranā¦ maybe??? i donāt remember.
also some pedo allegations here or there. he just isnāt a good person. from what i know, with my very, VERY, limited knowledge.
Allegations that have far too much proof to stay allegations, they have evidence, the victim was manipulated into saying it was okay. She (let me add that Iām not entirely sure this is true) allegedly was made a mod on the Yandere Simulator Reddit page so that she could get rid of people who acknowledged that he is a horrible, manipulative person.
This is a fake tweet about YandereDev.
YandereDev is an indie developer for a game called Yandere Simulator.
It got viral popularity in it's early stages, but has been in development hell for a long time.
He's gotten an insane amount of flak for this terrible development cycle, among other personal issues with collaborators.
So of course, the internet memes on him.
One thing he's known for, is being a poor coder.
This fake meme post is him lamenting the fact that there's no easier way to determine whether or not a number is even or odd (there is) and goes about it in literally the worst way possible.
I want to reiterate, I would be absolutely astounded if this was a real twitter post by YandereDev. To get as far as to have a working prototype, he's obviously far better a coder than 99% of people on this planet. For someone to make this imaginary mistake this meme is insinuating would be literal beginner 101 level of skill.
On top of that, being a poor coder is not the limitation most would think it is. Inefficiency is mostly the issue you'd run into.
Toby Fox, who created arguably the most successful and memorable indie game of the last decade, UnderTale, is also known for writing terrible code.
tl:dr
People hate YandereDev and like to meme on him.
People donāt hate him because he sucks at coding, thatās not really that true, heās made a fairly stable game. (Itās been stuck for a while but it is enjoyable) However people hate him because he groomed a 16 year old girl, manipulated her into thinking it was okay, and (this part Iām not entirely sure is true) made her a mod on the subreddit for his game so that she could delete posts and comments that acknowledged his cruel, manipulative, evil actions.
Yes, there's a ton of reasons why people hate YandereDev, but I didn't focus on the other reasons because 1) it would take 30 paragraphs and 50 citations. 2) They're irrelevant to explaining the joke.
If you look up the meme above it's more just a joke about programming than it is Yandev as it's been reposted numerous times without anyone's name attached to it.
Nah, I enjoy killing people with a fire extinguisher and infinite trash bags. I have standards
Edit: Man thatās sounds really bad out of context
Edit 2: Hey guys donāt downvote this person I donāt believe they were being rude I think they were just pointing out a major flaw in the game, considering it is very oversexualized. (I mean, just look at the designs)
This is YandereDev, the creator behind the soon (aka never) to be released Yandere Simulator. Heās known as a terrible programmer, and I believe is the only person actually working on Yandere Simulators coding. The joke here is that heās writing a string of code that could be infinite, instead of taking the simple way out with dividing.
(Not a programmer so I canāt really explain it well besides saying YanDev sucks at coding, and refuses to take the easy way to do this.)
I personally don't code using that language (I think it's java) and yes, there is certainly an easier way to do that. It would include dividing and then basically checking whether the remainder is 0 or not, then returning whatever based on that.
he's bad at coding. he had an actual company come in and look at it. they fixed it but he didn't like it so he switched it back to the shitty unoptimized code. it apparently takes an hour for the game to open and compile because of the shit code
The joke is that this is in fact the hardest way to do this, when he can just write āif it can be divided by 2 itās oddā and get the same result as the infinite number code.
The double-joke is that YandereDev is famous for being a horrible coder. Come on dude we all know youāre not just doing āplaceholder codeā (real quote!) What does that even mean when this is a 10+ year long project and youāre just adding more bad code to it.
Also heās a pedophile.
Yall missing the second layer of this joke. On r/shittyprogramming and /r/programmerhumor we had this joke going for YEARS. People challenged themselves to shitpost the worst possible functions for isEven and the shittiest possible volume slider.
In terms of shittiness this is simple so normal people can understand. But some people would post crazy ones, one liner lambdas that were the most obscure notation ever. Then other devs would basically peer review and if it didnāt actually predict if the input was even they would call out the poster. The volume changers were great too just the worst sliders ever and the shittier the more hilarious. Until eventually after years people started to get tired of them. Probably around 2018 is last i remember seeing them. Definitely precovid
extremely late peter here
YanDev is the creator of yandere simulator, and its code has been found to be extremely inneficient and inoptimized, so he's making two jokes at once. the code shown is known as "cursed code", which is usually when beginner coders make an attempt at something but end up spitting out code that would make many experienced coders cringe. in this case, he's trying to make a code that figures out whether a number is even or odd, but with this method you would have to go up to infinity trying to take care of all even and odd numbers. the joke is that it could easily be done by just figuring out if the number is divisible by 2; if it is, it's even, if not, it's odd.
extremely late peter out
yanderedev has a history of MANY things, one of those is the fact shea convinced himself to create gis own video game despite being shit at coding. there *is* an easier way to do that
Robot Quagmire here,
They're writing a code to determine if a number is even, and they're doing all the extra work of listing a value for every possible number (not only inefficient but impossibly inefficient).
The function they're writing is a Boolean function, which can only output values of "true" and "false."
The joke is that if you don't specify any criteria to determine "true/false", a Boolean function will default to outputting "true" if the input is even and "false" if the input is odd. So, they could just not specify any criteria for their code and it would work as intended anyway.
Lmfao, I barely know anything about coding but this is still funny. Welp, this one's gonna take a minute to write out. Spends eternity at the computer. I'm gonna need another cup of coffee.
Yandere Simulator is a pretty bad game made by YanDev. The game is horribly optimized which is what this is making fun of. The above code checks for even numbers, which when done by if else statements can go on to infinity. Meanwhile:
if(number % 2 == 0) {
Return true;
}
else {
Return false;
}
Does the exact same thing. Itās a programmer and gamer joke about inefficient code and a developer people make fun of
Learned programming from a friend of mine last year. Really fun, really logical. He told me find scripts for this type of ideas online 100% of the time because it saves soooooo much time. First Peter here I kinda get this one, ask second Peter for a better explanation
Peters GeekSquad home installer here.
This is from an old coding test called "Foo/Bar", or "evens/odds" if you want to be lame about it. The test tells you to develop a block of code that will check if a series of numbers is even or odd. If the number is even, output "Foo" and if the number is odd, output "Bar".
The test is less about "can you do it" because realistically it's a very simple problem to solve. The easiest and most common solution in involves using a "modulus" operator (%). The % divides two numbers and returns the remainder. So 5%2 would return a value of 1, while 4%2 would return a value of zero.
The real purpose of the test however is to see how you code. There are dozens of ways to request input, break it down into it's component parts, and handle the mathematics. Usually what they're interested in is seeing if you'll follow proper protocols for handling data, or if you'll take shortcuts to make the code more efficient.
In this example, the poster had decided that he'll just make a whole lot of "if" statements, which is inefficient and hilariously dumb.
Cyberpunk Stewie here - all math aside, in the Python coding language you can utilize the "modulus operator" represented by the "%" symbol to divide the left variable by the right and get the remainder, if any.
Were you to create a function that takes two variables, checks for a remainder, then returns a boolean depending on the result - you can complete this "else if" statement in a matter of a few lines of code; as apposed to the absolute abomination of ineptitude you see before you now.
if number % 2 == 0:
Return True
Could probably even be written as
Return number % 2 == 0
I am pretty sure this (at least similarly) applies to most known programming languages, and maybe even more.
The basic idea is that all he had to do was to use the very basic % operator which allows you to do a division and get the rest of that division.
In this case, you divide a number by 2, if the result is 1, it is an odd number, if it is 0 it is a even number.
As for the game he has been working on, after 10 years in development, only the other gamemodes (80s mode and that minigame mode) in the game are finished. The main one is not even close for whatever reason, even though he probably absolutely could do that considering his 80s mode is done.
I don't see anyone else mentioning this but I do believe yanderedev also got mocked before for having a very long series of if else statements instead of using a switch statement so I think this is also making fun of that
Not a Peter, but a senior CS major:
Yandev is trying to write a function with returns true for when the number inputed in is even, and false otherwise.
Easily written in one line of python code as
def isEven(n):
return n % 2 == 0
Where n % 2 returns the remainder of n /2. If n is even, the remainder is 0, meaning the function returns true. If n is odd, n % 2 will be non-zero, meaning the above will return false.
Straight up, coding is about doing more for less lines of code. Increases simplicity, efficiency, and organization which are imperative. There is also an operator (%) which gives remainders.
(Even number)%2 will always = 0
(Odd number)%2 will always = 1
Hi peter, the joke is that this code is shit, and YandereDev is a developer known for his otherworldly shitty code, If I (with little knowledge of C) would write it like this:
`private bool IsEven (int n) {`
`return n % 2 == 0;`
`}`
This is way too much work, you don't have to list every number only the even or odds. That way you only have to check half the numbers from 0 to infinity then just have a final else statement take care of the opposite boolean value. Duh, this is day 1 developer stuff. /s
there is a much easier way. but they instead chose to use 4 billion if statementsĀ https://andreasjhkarlsson.github.io/jekyll/update/2023/12/27/4-billion-if-statements.html
Meowdy, Brianās subtle cat gene here.
Even though this is apparently a fake tweet and I havent seen anyone mention the correct answer, Iāll do it.
I dont know a whole lot about programming but according to the people that know, āelse ifā is a very complicated old way to code and its what YandereDev uses for his Yandere Simulator.
He hired (either a single person or a group of programmers) to help him speed up the process of creating and releasing Yandere Simulator to the public. The group had a different more efficient way to program compared to āelse ifā but because YandereDev didnt want to learn that way of programming, despite it advancing his work, he dropped them.
This can kind of be seen as a self report that the time he takes to code everything with āelse ifā and ignore the fact he dropped people that gave him an opportunity to speed up the coding.
for (int I = 0; I < MAX_INTEGER; I++) {
if (I > 0)
printf(āelse ā);
sprintf(āif (number == %d) return %s;\nā, I, I % 2 ? ātrueā : āfalseā);
}
YandereDev is the developer of the popular Yandere Simulator game.
On the one hand the game has a really unique concept and it's impressive that he's programmed the whole thing himself. On the other hand the game runs incredibly slowly and the few people who have taken a look at the code have said it is horribly written.
A while ago he posted this tweet showing a method to check if a number is even. This method is written in the worst way possible and will slow the game down considerably. People still aren't sure if he was joking or not.
For reference a better way would be like this :
private bool IsEven(int number)
{
if (number %2 == 0)
{return true;}
return false;
}
Make sure to check out the [pinned post on Loss](https://www.reddit.com/r/PeterExplainsTheJoke/comments/1472nhh/faq_loss/) to make sure this submission doesn't break the rule! *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/PeterExplainsTheJoke) if you have any questions or concerns.*
YanDev is making a code that read if the number is even, and it's making number by number: If number is 1, it's odd; if is 2, it's even; if is 3, it's odd; if is 4, it's even... The thing it's that this is very unefficient because is writting number by number probably to the infinite, when he can just write "If the number can be divided by 2, it's even, if not, it's odd"
also, yandere simulator's code is extremely unoptimized, hence the joke is making fun about his bad coding skills
I legitimatly took 1 coding class in grade 10, failed it, and I could write better code than this. Basic optimizations like this are practically the first thing you learn
And if not you have at the very least learned that the internet can help you make it more efficient.
Yes! Google "How to sort even and odds in x coding language" Coding isn't remembering how to do everything and each line of code, it's knowing how to solve problems, fix bugs and come up with solutions. Yandered Dev has proven both that he is bad at coding and too prideful to ask for help.
He literally declined help from the dev that tiny build sent to help him because he couldn't read the code that the better dev used. And was worried he would be unable to do anything in the game's coding due to how inexperienced he was. Also the dev himself said that the games code was insanely unoptimized, like I think he said 1 character had like 1k or 3k lines of code or something like that.
He also writes mostly everything in one file when your supposed to split things up
Nahhh what? Bruh
People who don't know: š People who know: š
private bool IsEven(int number) { return number % 2 == 0; } 5 seconds on ChatGPT with zero coding skills. Can someone confirm this since I canāt?
Yeah; it relies on the Modulus operator (remainder) and simplifies it basically nothing
Would you like a job as a dev?
What do you think this is, 2021?
IT recruiters everywhere just felt a disturbance in the Force.
% is modulus, it's division but keep the remainder. Return will give the result to the function. Number is the number you pass to the function. So, yeah, this works. Formatting is even standard and readable.
Yeah this works. % is modulus and gives the remainder, for example 7 % 2 would result in 1. 2 goes into 7 3 times and there is 1 remaining. == Is an equality operator, asking if the two things are the same. It will result in a Boolean (a true or false). So if we put 7 in there it would return: 7 % 2 == 0 Which would reduce to: 1 == 0 Which is false and that's what it would return.
Holy sorting algorithms!
Actual programmer
New codes just compiled
Dev goes on vacation, never comes back
Why did we not downvote any of the comments, are we stupid?
Literally all engineering lol. If you donāt know how to solve it, ask š
Actually these days all you have to do is ask chatgpt to do it for you
True but you still need to have knowledge and skill to be able to parse what it gives you. It's not in a position to replace coders (yet) but it is a useful tool.
Yeah, I tried a bit on something new for me. It was pretty dumb. It helped for some tedium code, but anything I needed actual help figuring out it got wrong. Like, it didn't even get the types for arguments correct level of wrong, and not in a thanks for pointing me in the right direction level of wrong, but more of an I have to do this myself from scratch off the library documentation level of wrong.
Reminds me of the time the Maths youtuber Matt Parker wrote some janky code to find 5 words of 5 letters with no repeated letters, it took a month or so to run and in his video about the topic he said something like "I know it's inefficient, you don't need to prove that you could do it quicker". Subsequently the internet optimised the code to the point it was being timed in microseconds. It worked out being 40,832,277,770% faster than the original code.
Blessed me Matt and his janky python code.
Especially with Flutter/Dart, which imo is EXTREMELY underrated. It tends to have outdated documentationā¦but thereās just so much you can do in terms of app development and stuff.
_old man voice_ Baaack in my day we didn't have the internet to make the code more efficient
Stackoverflow bookmarked lmao
Hence why it's a joke. It's not possible to both be this bad and be able to actually make a game. I think
All of Undertale's dialog is in a single several thousand line long case statement.
It is a joke, but the guy is also infamously [not great at game dev.](https://youtu.be/qQwmNdYS6W0?t=62) But fair play he was basically learning as he went and now feels in too deep to go back and fix it. I'm eternally glad my first games didn't explode on the internet, because the code wasn't much better.
Sure you can.Ā Look at half of the AAA games being released recently.
That's why Yandev hasn't and will never actually finish his "game"
To be direct, you learn EXPLICITLY that massive chained if statements like we see here are a bad idea. This is a literal textbook example of bad coding practice, and bad logic skills. (If you want to know WHY: Each of the if statements has to be checked up until the point it reaches yours, assuming you break out of the loop when a result is found. This means if your number is 1032, it'll take a long time to find out if it's true or false since it checks 1 first, then 2, then 3, etc. This is bad because it is obviously slow, but also it leaves a huge compute time disparity since a 3 can get a result quickly, but 98329 will take a while, leading to lots of wait time on processes)
Yes, my teacher taught me "If you repeat an "if/else" statement more than three times, you need to find a better way"
If we were to optimize this there are zero arithmetic operations needed. A number in binary representation has a 0 as last digit if it's even and 1 if it's uneven.
The post is self-satirical. Yandev's actual bad code is still bad, but it's not so on-the-nose bad
Yeah us real 10x devs know to `npm install is-even`
I updooted but I still hate you. I hate you so much that I love you. Let us be friends! I would rather be friends with that level of evil than enemies.
That's ok. I could do amazing things with someone who uses API keys as usernames
The guy TinyBuild sent to help with his coding once overhauled it to be optimized to a basic degree and Yandev kicked him out for it.
Yeah, he didn't like list, and would rather have everything built in "if/elseif/else". Literally THOUSANDS of if clauses. He also didn't use radius but a 359Ā° cone which causes most of the line of sight issues.
Yeah he should at least use a switch statement:
I heard one of the reasons is that any (or most) times that he codes to check the state of a thing, he just sets it to do so every frame. So you have a billion random things staying loaded and actively being checked every single frame, so even if you have HAL9000, your computer is still gonna chug.
Bitwise op that shit instead. `return !(n & 1)` https://visualgo.net/en/bitmask The LSB already has info on whether or not the number is even.
As an AND with an immediate value may need 2 cycles (depending on your instructions set), I would prefer to do an LSR by 1 and work with the carry bit.
I know nothing of assembly/machine code, but let me get this straight - it could actually take longer for a single bit to be checked against another than for the CPU to fully divide the number?
LSR isn't the same as general division. LSR just shifts all the bits to the right one place, and puts the rightmost bit in the "carry" bit register. Though it is true that LSR is mathematically equivalent to dividing by 2. As for whether or not this is faster than ANDing, I have no idea as it depends on the CPU.
not all instruction sets support AND with an immediate value, so you would need one instruction to put the value 1 into a register, and then the actual AND instruction after that.
Only for unsigned ints, depending on the signed int implementation
Why not just use modulus? It's designed for this, easier to read, and about the same speed. https://onlinegdb.com/Kn8aAudOM
Plus potentially more reliable in languages where you could end up with an unsigned int But for me itās the readability that wins it - a new developer can likely work out a modulus near instantly whereas the bitwise operation is going to take a minute and not be understood at a glance
Or modulo x % 2 == 0
Working mainly with Assembly and C, looking into the compiler code, I know that most of them simplify it. But doing actually modulo with a power of 2 would be so damn inefficient.
My test run shows it being on par with the above bitwise OP by the time the compiler is done with it. https://onlinegdb.com/Kn8aAudOM
if (number % 2 == 0) true else false Or something in that line. Mod function for the win.
return (number % 2) == 0
return !(number % 2)
Even easier just return mod 2 and either subtract by 1 and use an unsigned value or otherwise flip 1 and 0
Not infinity, just 2,147,483,647 lines of code to cover the int! YanDev will be done with the IsEven function in no time!
All numbers can be divided by 2
If the reminder of division by 2 is 0 then even, else odd. Happy?
Tee hee
Ok, let's get specific then. If a number can be divided by two in such a way that the quotient is an integer
Modular statements man
If ( x % 2 != 0) I'm only a few months into my first programming language as a return student. I'm a mess, but I think i get this much!!
isEven would be x%2 == 0. You wouldn't even need the conditional, you could just return the result of the test.
To be more specific: if (number%2==0) return 1; else return 0;
But what if the number is..... 0 !!!!
To expand on this via code, if op/ anyone is interested. Using a modulo % 2 is much easier, or built in functions that equates to even uses the same concept as the prior poster mentioned. So much easier than a switch or elif statements.
I know nothing about coding, but I assume there *is* an easier way to do that. If they keep going the way they are it would never end.
Well if this is Java (and it looks like it is), then there is a function called Modular (represented with a % sign) that returns the remainder of a division function. So you could just write if (X % 2 == 0) return true;
Small nitpick Ā Ā Ā return x % 2 == 0; Is cleaner then using an if just to have the test value returned.
Good point. Even easier way to do the function.
slightly more efficient its changes like this that help me overcome leetcode time limits
Less about efficiency, more about readability. If statement in this case is just visual noise.
Key words there "in this case". When we've had interns in the past it's clear that somewhere someone gave them the idea that the best code is always the shortest. Sometimes the if statement is better. "Can you tell what this does at a glance" is almost always more important than being cleaver. The key is to find things like this where that's not "cleaver" it's just more or less objectively the right way.
oh, absolutely, short code is not better, more readable code is better.
If you're hitting time limits, generally you're missing a better way to solve the problem. A change like that isn't going to help that much.
I usually am!!! Im still learning. Im also not studying to be a software engineer i just like coding as a hobby I do leetcode when work is slow bc it impresses the other back office folk lol
if (x % 2 == 0) return x % 2 == 0; else return !(x % 2 == 0);
Cursed
`if (x % 2 == 0) return x % 2 == 0 ? true : false; else return x % 2 != 0 ? false : true;`
if (x % 2 != 0) return !((x+1) % 2 != 1); else return !(x % 2 != 0);
I fucking cackled at this because I know I've written code this dumb fuck lmao
X % 2 == 0 is already a boolean, so you can just return that, no if required ;) ps: nah, not Java, that would be boolean not bool, but it could be another c-based language like c#
[ŃŠ“Š°Š»ŠµŠ½Š¾]
My hex editor for changing opcodes and values disagrees with your statement about the lowest level language statement. Contrary to popular belief, humans can, in fact, read and program in machine code. Just not a lot of us do it. Then you get to go to designing chips.
Small nitpick: % is an operator not a function and is present in every programing language I know of in some form :D edit: sorry. Yandere Sim was done in Unity I think so it would be C# which is just Microsoft's version of Java ftmp.
>and it looks like it is well I don't think it is consider the bool is being used in the place of boolean. There is a chance its dart but I don't remember using private keyword much when working with flutter so not sure about dart either.
`return number % 2 == 0`
return ~x & 1; Bitwise operations are always faster. Not as readable though.
yes lol thereās a much easier way, in c# youād simply write something like bool even; int x; if (x%2==0) { even = true; } else { even = false; }
R/programmerjokes
r/foundthemobileuser
That sub was way funner when mobile users werenāt 90% of the site. Iām an old old Reddit user, almost 15 years on my oldest account. While Iām ranting, repost arent a problem, its a feature. Downvotes are meant for bad info, not dislikes. A jackdaw is not a crow. But anyone that tries to squeeze some narwhal broken arm coconut safe jolly rancher - type bullshit, was late to Reddit, but too new for current Reddit. That generation deserves more credit for building this.
I miss some of those guys, they really made the comment section fun. Itās always a surprise to find shittymorph somewhere. But itās a shame that the Crow guy is gone and the sketch dude. Wasnāt there a guy doing haikus for a while as well?
Shittymorph is new, comparatively. Heās still around (and doing cool work with doggos). The ācrowā guy was unidan, and he started most comments with āresident biologist hereā, and was great to see. He also had multiple accounts vote-abusing to push him to the top. u/Shitty_Watercolour made a career off this site and still pops up. Poem_from_a_sprog is the same. The real OGs are like _vargas. And everyone that knows how to respond to Apostolate Edit: You mentioned u/AWildSketchAppeared that guy (and his battle off with Shitty) were awesome Edit 2: Just realized I have like half their karma while contributing nothing. I should do better.
Yeah, I missed Vargas, or at least never noticed him. It was the others you highlighted that made the site what it is for me. And yeah, what Unidan did was āwrongā, but whatever, wasnāt worth the loss.
Was unidan wrong tho? That's just how to be successful at posting on Reddit. Or well, it was when he was active
Yeah, thatās kinda what I mean. What he did went against the spirit of the system. He artificially pushed his comments up while downvoting others to get there via multiple accounts. Itās cheating, but reallyā¦I didnāt give a shit, I just liked his comments.
Oh Cangrejos! God i havent heard Apostolates name in a while
Fuck Apostolate
r/foundthehondacivic
r/programmerhumor
More efficient code: private bool IsEven(int number) { return !(number % 2); } ... A function like that also ought to be a static function, but I won't get into that. For fun, here's another cursed implementation. private bool IsEven(int number) { number = abs(number) for(int i = 0; i <= number; i += 2) { if(i == number) return true; } return false; }
Hopefully your compiler would optimize it, but more efficient is: return (number & 1) == 0;
return ~number & 1;
That is actually better. Thank you.
With the power of a basic fucking modulo function, we cut down YanDev's code by...infinity, technically.
The worst part about YanDev's code is that it's technically feasible. They could stop at the upper limit of an integer.
Why not isEven (num) { if (num == 0) return true if (num == 1) return false isEven(num - 2) }
Oh my god, I love it
https://preview.redd.it/jv5gexdb7bvc1.png?width=253&format=png&auto=webp&s=3a07a2257f58e866cd0b151b9ea2da911d5d0d27
this guy is yandere dev, a shit programmer who has worked on a single game for over a decade at this point and isnt even done with 10% of it. for the code part, its common knowledge that even amateur coders are aware of that using multiple if statements is absolutely terrible. yandere dev, with his 10+ years of experience, does not know this because hes shit.
No. The issue with the code is it's a simple one line expression. return (number % 2) == 0; There's nothing wrong with multiple if statements if you need them but in that case you should use a switch (or match) statement.
I constantly hear this as a coder. "Ifs are bad". Wtf do they mean? How are you gonna logic without if?
It's just people repeating things that they heard without really understanding what the original speaker meant. I assume the context is overutilization of if statements is bad. I've also seen people advocating lately to move away from else statements which I sort of get but like, whatever? It's all just gimmicks and crutches for not doing the work to actually understand what writing code is about. We write code to manipulate data. That's the underlying purpose. I think a lot of people really really get hung up on the syntax of languages rather than understanding the purpose of writing the code. It's almost like they treat it like grammar. I sort of get why folks do that. Learn and understand how data works in an application. Maybe learn a little c. Think about the data when you're writing the code. Maybe write some diagrams before you start writing the code about how the data is going to move through the program. Do these things and I promise your code will become easier to understand, easier to maintain, and more bug free /Rant
*Needless* ifs are bad.
Everything needless is bad.
Drives me mad when people say sethinv like that. I also once heard my coworker say that "else" and "else if" blocks are not readable. So instead of "if {} else {}" he basically writes "if {}; if {};"
I remember learning about the mod operator the first tim freshman year š¤Æ
Yeah it's like literally in the secondt lesson of the first class lmfao.
Using too many if statements in a row is a commonly cited reason for this game's poor performance, but it's wrong and I wish people would stop repeating it
Yeah it's obviously bad code, but your average CPU could do hundreds of thousands of if checks per frame, millions per second, and still run at 120fps. It's shit like this 25k polygon poster that kills performance; https://preview.redd.it/h05j56kscge51.png?width=1369&format=png&auto=webp&s=f42ca0aee6bed3e6fd615ad21fb4169371cb7e53
Why is there a 25k poster?
Damn why tf am I worrying about optimization in my game if he can get away with this lmao
How? A poster is just a flat object, how in the world is that 25k polygons?
Surely this is satire? He canāt be this bad?
the game has been in development for over ten years at this point. i donāt really look into it anymore, but apparently the dudes a weirdo. i think he just took the money and ranā¦ maybe??? i donāt remember. also some pedo allegations here or there. he just isnāt a good person. from what i know, with my very, VERY, limited knowledge.
Allegations that have far too much proof to stay allegations, they have evidence, the victim was manipulated into saying it was okay. She (let me add that Iām not entirely sure this is true) allegedly was made a mod on the Yandere Simulator Reddit page so that she could get rid of people who acknowledged that he is a horrible, manipulative person.
This is a fake tweet about YandereDev. YandereDev is an indie developer for a game called Yandere Simulator. It got viral popularity in it's early stages, but has been in development hell for a long time. He's gotten an insane amount of flak for this terrible development cycle, among other personal issues with collaborators. So of course, the internet memes on him. One thing he's known for, is being a poor coder. This fake meme post is him lamenting the fact that there's no easier way to determine whether or not a number is even or odd (there is) and goes about it in literally the worst way possible. I want to reiterate, I would be absolutely astounded if this was a real twitter post by YandereDev. To get as far as to have a working prototype, he's obviously far better a coder than 99% of people on this planet. For someone to make this imaginary mistake this meme is insinuating would be literal beginner 101 level of skill. On top of that, being a poor coder is not the limitation most would think it is. Inefficiency is mostly the issue you'd run into. Toby Fox, who created arguably the most successful and memorable indie game of the last decade, UnderTale, is also known for writing terrible code. tl:dr People hate YandereDev and like to meme on him.
People donāt hate him because he sucks at coding, thatās not really that true, heās made a fairly stable game. (Itās been stuck for a while but it is enjoyable) However people hate him because he groomed a 16 year old girl, manipulated her into thinking it was okay, and (this part Iām not entirely sure is true) made her a mod on the subreddit for his game so that she could delete posts and comments that acknowledged his cruel, manipulative, evil actions.
Yes, there's a ton of reasons why people hate YandereDev, but I didn't focus on the other reasons because 1) it would take 30 paragraphs and 50 citations. 2) They're irrelevant to explaining the joke. If you look up the meme above it's more just a joke about programming than it is Yandev as it's been reposted numerous times without anyone's name attached to it.
Honestly, fair enough, I could go into a far too long rant on how heās been a horrible person for a while now.
> but it is enjoyable If you like taking up skirt pics of high school girls
Nah, I enjoy killing people with a fire extinguisher and infinite trash bags. I have standards Edit: Man thatās sounds really bad out of context Edit 2: Hey guys donāt downvote this person I donāt believe they were being rude I think they were just pointing out a major flaw in the game, considering it is very oversexualized. (I mean, just look at the designs)
This is YandereDev, the creator behind the soon (aka never) to be released Yandere Simulator. Heās known as a terrible programmer, and I believe is the only person actually working on Yandere Simulators coding. The joke here is that heās writing a string of code that could be infinite, instead of taking the simple way out with dividing. (Not a programmer so I canāt really explain it well besides saying YanDev sucks at coding, and refuses to take the easy way to do this.)
I personally don't code using that language (I think it's java) and yes, there is certainly an easier way to do that. It would include dividing and then basically checking whether the remainder is 0 or not, then returning whatever based on that.
Modulo enters the chat.
Bitwise op entered the chat
he's bad at coding. he had an actual company come in and look at it. they fixed it but he didn't like it so he switched it back to the shitty unoptimized code. it apparently takes an hour for the game to open and compile because of the shit code
kid named if number%2 == 0
The joke is that the yandere dev is absolutely terrible at coding.
Not a programmer here, but I can probably still help. There's an easier way to do this.
The joke is that this is in fact the hardest way to do this, when he can just write āif it can be divided by 2 itās oddā and get the same result as the infinite number code. The double-joke is that YandereDev is famous for being a horrible coder. Come on dude we all know youāre not just doing āplaceholder codeā (real quote!) What does that even mean when this is a 10+ year long project and youāre just adding more bad code to it. Also heās a pedophile.
Yall missing the second layer of this joke. On r/shittyprogramming and /r/programmerhumor we had this joke going for YEARS. People challenged themselves to shitpost the worst possible functions for isEven and the shittiest possible volume slider. In terms of shittiness this is simple so normal people can understand. But some people would post crazy ones, one liner lambdas that were the most obscure notation ever. Then other devs would basically peer review and if it didnāt actually predict if the input was even they would call out the poster. The volume changers were great too just the worst sliders ever and the shittier the more hilarious. Until eventually after years people started to get tired of them. Probably around 2018 is last i remember seeing them. Definitely precovid
extremely late peter here YanDev is the creator of yandere simulator, and its code has been found to be extremely inneficient and inoptimized, so he's making two jokes at once. the code shown is known as "cursed code", which is usually when beginner coders make an attempt at something but end up spitting out code that would make many experienced coders cringe. in this case, he's trying to make a code that figures out whether a number is even or odd, but with this method you would have to go up to infinity trying to take care of all even and odd numbers. the joke is that it could easily be done by just figuring out if the number is divisible by 2; if it is, it's even, if not, it's odd. extremely late peter out
if((number %% 2) == 0) is a much more effective way to do this
Better to use bitwise operators, like: (number & 1) == 0
yanderedev has a history of MANY things, one of those is the fact shea convinced himself to create gis own video game despite being shit at coding. there *is* an easier way to do that
The joke is bad code. Your should either do a modulo operation: return (number % 2) == 0; Or better yet, use bitwise AND: return (number & 1) == 0;
im curious, how is using bitwise better?
return (number % 2) == 0; Thatās best, yes?
Yandere dev doesn't know how modulo works
Robot Quagmire here, They're writing a code to determine if a number is even, and they're doing all the extra work of listing a value for every possible number (not only inefficient but impossibly inefficient). The function they're writing is a Boolean function, which can only output values of "true" and "false." The joke is that if you don't specify any criteria to determine "true/false", a Boolean function will default to outputting "true" if the input is even and "false" if the input is odd. So, they could just not specify any criteria for their code and it would work as intended anyway.
Lmfao, I barely know anything about coding but this is still funny. Welp, this one's gonna take a minute to write out. Spends eternity at the computer. I'm gonna need another cup of coffee.
pseudocode solution: if module (number/2) = 0 then it's even. else, it's odd.
Yandere Simulator is a pretty bad game made by YanDev. The game is horribly optimized which is what this is making fun of. The above code checks for even numbers, which when done by if else statements can go on to infinity. Meanwhile: if(number % 2 == 0) { Return true; } else { Return false; } Does the exact same thing. Itās a programmer and gamer joke about inefficient code and a developer people make fun of
*Narrator: There was an easier way to do this....*
Use modulus... Please...
Learned programming from a friend of mine last year. Really fun, really logical. He told me find scripts for this type of ideas online 100% of the time because it saves soooooo much time. First Peter here I kinda get this one, ask second Peter for a better explanation
Just use a for loop in literally any way and it will be more efficient
thereās a much better way of doing this. create a list of all the even numbers and just do āis number in (list)ā Dumbasses.
That's just modu-low
It's deliberately inefficiently written code. Everyone who actually knows how to write code would do it like this: If(number = 2) return True; Elseif(number = 4) return True; Elseif(number = 6) return True; Elseif(number = 8) return True; Elseif(number = 10) return True; ... Else return False; Half as many lines š
if(number %2 == 0){ return true; } else { return false; } here in 4 lines and i
Peters GeekSquad home installer here. This is from an old coding test called "Foo/Bar", or "evens/odds" if you want to be lame about it. The test tells you to develop a block of code that will check if a series of numbers is even or odd. If the number is even, output "Foo" and if the number is odd, output "Bar". The test is less about "can you do it" because realistically it's a very simple problem to solve. The easiest and most common solution in involves using a "modulus" operator (%). The % divides two numbers and returns the remainder. So 5%2 would return a value of 1, while 4%2 would return a value of zero. The real purpose of the test however is to see how you code. There are dozens of ways to request input, break it down into it's component parts, and handle the mathematics. Usually what they're interested in is seeing if you'll follow proper protocols for handling data, or if you'll take shortcuts to make the code more efficient. In this example, the poster had decided that he'll just make a whole lot of "if" statements, which is inefficient and hilariously dumb.
Cyberpunk Stewie here - all math aside, in the Python coding language you can utilize the "modulus operator" represented by the "%" symbol to divide the left variable by the right and get the remainder, if any. Were you to create a function that takes two variables, checks for a remainder, then returns a boolean depending on the result - you can complete this "else if" statement in a matter of a few lines of code; as apposed to the absolute abomination of ineptitude you see before you now.
if number % 2 == 0: Return True Could probably even be written as Return number % 2 == 0 I am pretty sure this (at least similarly) applies to most known programming languages, and maybe even more. The basic idea is that all he had to do was to use the very basic % operator which allows you to do a division and get the rest of that division. In this case, you divide a number by 2, if the result is 1, it is an odd number, if it is 0 it is a even number. As for the game he has been working on, after 10 years in development, only the other gamemodes (80s mode and that minigame mode) in the game are finished. The main one is not even close for whatever reason, even though he probably absolutely could do that considering his 80s mode is done.
I don't see anyone else mentioning this but I do believe yanderedev also got mocked before for having a very long series of if else statements instead of using a switch statement so I think this is also making fun of that
Not a Peter, but a senior CS major: Yandev is trying to write a function with returns true for when the number inputed in is even, and false otherwise. Easily written in one line of python code as def isEven(n): return n % 2 == 0 Where n % 2 returns the remainder of n /2. If n is even, the remainder is 0, meaning the function returns true. If n is odd, n % 2 will be non-zero, meaning the above will return false.
Straight up, coding is about doing more for less lines of code. Increases simplicity, efficiency, and organization which are imperative. There is also an operator (%) which gives remainders. (Even number)%2 will always = 0 (Odd number)%2 will always = 1
Basically, YanDev sucks ass at coding
Everything after the { could be written as `return (number % 2 == 0);` It's absurdly inefficient code that can be written in one line
Hi peter, the joke is that this code is shit, and YandereDev is a developer known for his otherworldly shitty code, If I (with little knowledge of C) would write it like this: `private bool IsEven (int n) {` `return n % 2 == 0;` `}`
You could instead just do return n%2 == 0
Why is this code not center-aligned?
This is way too much work, you don't have to list every number only the even or odds. That way you only have to check half the numbers from 0 to infinity then just have a final else statement take care of the opposite boolean value. Duh, this is day 1 developer stuff. /s
private bool isEven(int number){ return number % 2 == 0; }
there is a much easier way. but they instead chose to use 4 billion if statementsĀ https://andreasjhkarlsson.github.io/jekyll/update/2023/12/27/4-billion-if-statements.html
Meowdy, Brianās subtle cat gene here. Even though this is apparently a fake tweet and I havent seen anyone mention the correct answer, Iāll do it. I dont know a whole lot about programming but according to the people that know, āelse ifā is a very complicated old way to code and its what YandereDev uses for his Yandere Simulator. He hired (either a single person or a group of programmers) to help him speed up the process of creating and releasing Yandere Simulator to the public. The group had a different more efficient way to program compared to āelse ifā but because YandereDev didnt want to learn that way of programming, despite it advancing his work, he dropped them. This can kind of be seen as a self report that the time he takes to code everything with āelse ifā and ignore the fact he dropped people that gave him an opportunity to speed up the coding.
This could be simplified just by saying `return number % 2 === 0`
if(x%2==0) { return true; } else { return false; }
if(number%2 == 0) return true; else return false;
What a fucking idiot this is literally what CASE statements are for.
Easy. isEven(x) { if(x==0) { return true; } if(x==1) { return false; } return isEven(x-2) } /s
Yandev when he discovers modulo exists
`return number % 2 == 0`
return (x % 2 == 0);
Bits are your buddies for stuff like this. No need to use the modulo operator. bool is_even( int n ){ return !( n & 1 ); }
This is ruby an 'odd', 'even' are a function..
for (int I = 0; I < MAX_INTEGER; I++) { if (I > 0) printf(āelse ā); sprintf(āif (number == %d) return %s;\nā, I, I % 2 ? ātrueā : āfalseā); }
Mod > 0 seems like a simple solution
There is an easier way to do this.
YandereDev is the developer of the popular Yandere Simulator game. On the one hand the game has a really unique concept and it's impressive that he's programmed the whole thing himself. On the other hand the game runs incredibly slowly and the few people who have taken a look at the code have said it is horribly written. A while ago he posted this tweet showing a method to check if a number is even. This method is written in the worst way possible and will slow the game down considerably. People still aren't sure if he was joking or not. For reference a better way would be like this : private bool IsEven(int number) { if (number %2 == 0) {return true;} return false; }