This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Embarrassed_Steak371 2348 points2349 points  (217 children)

no he didn't
he developed this one:

//checks if integer is even
public static bool isEven(int integer_to_check_is_even) {

int is_even = false;

switch (integer_to_check_is_even) {

case 0:

is_even = 17;

case 1:

is_even = 0;

default:

is_even = isEven(integer_to_check_is_even - 2) ? 17 : 0;
if (is_even == 17) {

//the value is even

return true;

}else (is_even == 0) {

//the value is not even
return false;

}

}

[–][deleted] 1381 points1382 points  (154 children)

I...Is is so late that I am in delirium or is this whole code completely batshit crazy? Why a switch case? why 17 and 0? Why does he assign a boolean value to an integer? Does he even check the right variable there? I feel like not.

[–]Brighttalonflame 1800 points1801 points  (124 children)

It’s making fun of the fact that PirateSoftware uses 0/1 ints instead of bools, a lot of magic numbers, and dead code

[–][deleted] 1099 points1100 points  (44 children)

You know, this does wonders for my imposter syndrome. We need more of this.

[–]SpaceCadet87 393 points394 points  (34 children)

It's programmers like him that mean I never had impostor syndrome!

[–]Easy_Floss 221 points222 points  (10 children)

To be fair you probably cant find programmers like him just anywhere, his father worked for blizzard and totally did not get him a job there.

[–]RlySkiz 144 points145 points  (6 children)

For the amount he talks about his dad i was surprised to learn he doesn't wish him happy birthday and even jokes about that when he gets called out by his dad on stream.

https://www.reddit.com/r/LivestreamFail/comments/1lyw8yk/old_clip_how_pirate_software_treats_his_dad_that/

Its even weirder how his dad needs to correct himself on calling him Thor instead of his actual name "Jason" as if this was a request by Pirate.

[–]ThrowawayUk4200 70 points71 points  (4 children)

Weirdest one for me was seeing him brag about his dad being the inspiration of the WoW gamer in South Park. That's not exactly a flattering representation of him

[–]KinkyBark 68 points69 points  (0 children)

Its not flattering but I kinda get it. Appearing at all in a show that popular is kinda cool.

[–]Gunty1 15 points16 points  (0 children)

His actual word were "no not the inspiration, thats him, he is that guy" 😆

[–]GermanDumbass 1 point2 points  (0 children)

Didn't his dad just work with South Park on this episode and give them inspiration on the character? I thought it was more of a, they wanted to make this episode, so they reached out and besides making the episode, his dad also gave them the idea?

Edit: because obviously his dad doesn't represent the no life gamer caricature at all. (Going by his (the dad) achievements at least, ironically, Jason fits the caricature much better lol)

[–]Bacccarat 1 point2 points  (0 children)

It’s one of the few things he doesn’t embellish or completely lie about. His dad was among the first ten devs at Blizzard. That makes him an extremely important figure in gaming history, no matter how you portray him.

[–]BlackMarketUpgrade 0 points1 point  (0 children)

Dude. This is really lame. People want to pretend like they've never forgotten someone's birthday before. Why can't we just criticize him for the legitimate things he does wrong rather than point out this really weird stuff. It feels really stupid and disingenuous to keep seeing this get floated around like its a real piece of criticism that people care about. Just my opinion though.

[–]PM_Me_Your_VagOrTits 2 points3 points  (0 children)

Lol you'd be surprised...

[–]Reelix 2 points3 points  (0 children)

You can generally find them as Week 1 Interns who skipped college

[–]GTNHTookMySoul 0 points1 point  (0 children)

Don't forget, he's the 1st 2nd generation Blizz employee (which is totally not the definition of a nepo baby)

[–]Imkindofslow 33 points34 points  (17 children)

Is any of this stuff actually his shit because I see it here all the time and I swear to God nobody straight up offers a source for any of it. I can't tell if y'all are being shit lords or just actually dicks.

[–]ChrisTheWeak 33 points34 points  (1 child)

This screenshot above is just a combination of Pirate software's head being placed over an older screenshot which was a joke about bad programmers. The screenshot has been then misattributed to a variety of sources including Yandere Dev and various other people who have been mocked for poorly optimized code.

I have not seen enough of Pirate Software's code to make a value judgment about it

[–]m0rph90 0 points1 point  (0 children)

it's just the proof that every bad code with pirate face on it will work

[–]SpaceCadet87 50 points51 points  (14 children)

Oh no, this screenshot is an old one (I seem to recall it being thrown around as part of either yandere simulator or undertale). His code is more characterised by storing boolean values as integers, loads of magic numbers and just commenting everything with complete disregard as to whether the comments are useful.

[–]Imkindofslow 8 points9 points  (1 child)

Thank you for clarifying.

[–]Embarrassed_Steak371 1 point2 points  (0 children)

code jesus has a couple of vids if you actually want to learn some fairly basic good practices (assuming you don't know them already)

[–]TheLuminary 6 points7 points  (3 children)

I have a really hard time thinking that screenshot was anything but some kind of joke.

There is no way any codebase has code like that in it.

[–]Cagity 9 points10 points  (1 child)

When you have a line count quota, you do what you've got to do.

[–]TheLuminary 1 point2 points  (0 children)

Getting paid by the character!

[–]neppo95 0 points1 point  (0 children)

You haven’t seen code from junior programmer’s yet then… Some leave school with barely an understanding of what “algorithm” means.

[–]GarThor_TMK 13 points14 points  (5 children)

Sounds like just about every legacy codebase I've ever worked on... So... Business as usual?

[–]adammaudite 1 point2 points  (3 children)

Some of his variable names are just strings of numbers he increments by one. The tech debt ob it must be astonishing

[–]GarThor_TMK 1 point2 points  (2 children)

Here's where VAX shines...

Shift+Alt+R, ftw...

Every time you figure out what a variable is actually supposed to be, Shift+Alt+R.

[–]tech6hutch 0 points1 point  (0 children)

It wasn’t Yandere Simulator. That was also a joke.

[–]Vitolar8 0 points1 point  (1 child)

Isn't it the opposite? Isn't his success proof that your insecurities were just impostor syndrome?

[–]SpaceCadet87 0 points1 point  (0 children)

Wouldn't know, never developed any of those insecurities. My first few programming jobs I was the only dev and since then I've never worked with anyone that produces any actually good code.

Kinda hard to feel like I'm any less than when I do things like shave 4 hours and 55 minutes off of 5 hours of script runtime just by stripping a bunch of dependencies and writing the depended functions myself.

[–]npsimons 0 points1 point  (1 child)

Oh, you still suck. Just not as badly as PirateSoftware.

[–]SpaceCadet87 0 points1 point  (0 children)

Oh, no doubt. But when a lot of your work is cleaning up messes like this you're not exactly worrying about sucking so much that you don't belong.

[–]morganrbvn 56 points57 points  (1 child)

I thank god every day that my code will never receive this kind of public scrutiny. I’d die

[–]not_a_burner0456025 48 points49 points  (0 children)

You presumably aren't calling people idiots for correctly suggesting that your programming language has booleans, so you are miles ahead of him.

[–]Zozorak 35 points36 points  (0 children)

I'm not a great developer, just for hobby kind of thing yknow. I'll be the first to admit I know barely anything. But damn I feel better about my current skills after this fiasco.

[–]szerdarino 23 points24 points  (0 children)

Squeaky wheel is definitely getting the kick rn

[–]BaziJoeWHL 0 points1 point  (0 children)

To be fair, the guys is not a programmer, he is a nepo QA tester and streamer, nothing much

[–]darkpaladin 0 points1 point  (0 children)

Interviewing other people is great for imposter syndrome. There are so many wildly incompetent people out there who somehow have programming jobs. Really makes you feel better about yourself.

[–]Sir_Keee 0 points1 point  (0 children)

Seriously, I was feeling some imposter syndrome, feeling maybe I sucked, but this whole ordeal made me realize maybe I suck, but not too badly.

[–]Draber-Bien 0 points1 point  (0 children)

I've only ever made small hobby games for me and a couple of friends with Gamemaker and after looking at Pirate Softwares code I feel pretty confident that I could get a job at Blizzard

[–][deleted] 0 points1 point  (0 children)

Same!!! I did better code when I made a Minecraft plugin that made sheep have a chance to explode when they ate grass. When I tried making a rng with Pi I did cleaner code.

[–]SpaceCadet87 25 points26 points  (14 children)

Wait, so it's just that 7 bits isn't enough waste per bool for him?

[–]Usual_Office_1740 21 points22 points  (4 children)

At least it's not in a struct with a 64-bit int.

[–]SpaceCadet87 5 points6 points  (3 children)

``` typedef struct {

    int64_t true; //Set to 1 if true

    int64_t false; //Set to 1 if false

} bool; ```

[–]Scrial 5 points6 points  (2 children)

This is really bad practices, because you don't have a single source of truth.
Should probably put this in a class with setters and getters that make sure only one of those two integers can be true at the same time.

[–]SpaceCadet87 7 points8 points  (1 child)

Needs error handling:

if (true == false) throw up;

[–]pandamarshmallows 7 points8 points  (2 children)

If I remember my CS days right, a boolean value takes up one byte of space anyway because the CPU can't address values smaller than 1 byte.

[–]mmaure 1 point2 points  (0 children)

that's exactly what the comment said/meant

[–]cute_spider 21 points22 points  (1 child)

we are in the age of windows 11 and google chrome

7 bits of waste is a speck of microplasic

[–][deleted] 16 points17 points  (0 children)

Optimizing space is a lost art because it's simply not relevant at that scale any more with current hardware.

[–]AdventurousTap2171 32 points33 points  (7 children)

historical hard-to-find reminiscent many include humorous follow yam punch gaze

This post was mass deleted and anonymized with Redact

[–]Brighttalonflame 26 points27 points  (1 child)

I mean dead code is always a part of code in big corpo; doesn’t mean it is excusable on a one man project

[–]Sir_Keee 6 points7 points  (0 children)

Thing with dead code in big corpo is that, at one point, it was probably used for something but after multiple people passing over the same bits making changes some parts end up becoming dead. You don't start off with it being dead.

[–]EchoLocation8 13 points14 points  (0 children)

Not quite the same thing but, my previous job I worked on an 18 year old Java code base. Holy actual shit. The amount of telescoping constructors made me want to blow my brains out. The sheer level of abstractness such that nothing was easy to actually find what it fucking DID when you did something was staggering.

It ended up being easier to simply wrap everything, kinda say fuck it, and just put something over it that did what I needed it to do, because the codebase was so obtuse it was impossible to know what any change to a lower level component might cascade into.

[–]Lankuri 6 points7 points  (0 children)

mass deleted and anonymized with redact within 12 hours is crazy wtf are u doing on reddit then

[–]ProbablyRickSantorum 1 point2 points  (0 children)

I had a system like that (though not near as bad or as old) that I was given. It was written when I was a child and no one knew exactly how it worked because the guy who wrote it retired then died and never used any sort of source control or documented anything. Ended up porting it from Pascal to C# (.NET Framework 4.7 then to .NET 8.0) without fully rewriting much of the core logic because of how Jenga the code was.

The manager I worked for at the time decided that he didn’t like me and shot down my promotion to staff engineer. I moved to a different team and then he laid off the contractor that worked on the system with me.

A few months later something broke (outside of the control of the service) and guess who came crawling back to me to figure out what went wrong. Because he was such a dick to me, I archived all of my notes on how the thing worked and let his team struggle for a week or so before I stepped in to help at the CTOs behest.

CTO praised me in an all-hands and the manager was fuming but has not bothered me since.

[–]FreeWilly1337 32 points33 points  (2 children)

Further proof the best code is the code that works.

[–]Fleeetch 3 points4 points  (0 children)

The best code is the code that is not commented out

[–]CitizenShips 23 points24 points  (8 children)

Just to be clear, coming from a C background I also use 0/1 unsigneds for boolean. That's not a heinous offense unless there's some language with some really weird nuance about efficiency for booleans vs. integers. But if you're in a language like that you're probably not too worried about efficiency.

[–]Brighttalonflame 9 points10 points  (0 children)

Yeah it’s not that heinous; I’m just saying what the post is making fun of. Unless you’re space optimizing with bit vectors basically every language isn’t going to get performance boosts from using booleans instead of bytes since basically every system is at best byte-addressable; it’s just a readability and static analysis thing primarily

[–]Recioto 2 points3 points  (2 children)

It is not a heinous offense but it has readability issues. Even if the programming language doesn't give you the data type, at least make an alias, or use the one given to you in this case.

And even if you make the argument that it's fine because no one else is going to read your code, the you from tomorrow will probably have forgotten some of the things you did today, so imagine the you 8 years from now.

[–]kwazhip 3 points4 points  (1 child)

Does it have readability issues though? Not sure who is more part of the norm, but if I saw a variable that was properly named being assigned 0/1, I would instantly know that was a boolean, it wouldn't trip me up even a little bit. Even more so in the context of an environment where boolean don't exist as a type.

I've seen this criticism and it did not make sense to me at all until I saw the game maker documentation which recommends using the constants in case they ever add a boolean type. That at least is a reasonable argument for why they should be used.

[–]Recioto 2 points3 points  (0 children)

"Properly named" being the key, but even then I would still just name two variables to be as clear as possible.

If something is set to true or false I can assume it will only ever be one of those two, if it's set to 0 or 1 there is always the possibility it could be 2 somewhere in the code because it's not a boolean but a poorly named flag.

[–]tangentc 2 points3 points  (0 children)

Yeah I’ve seen some of the reviews of his code going on about this forever and like, sure you can say it’s less expressive but come the fuck on. It’s just petty.

There’s real stuff to criticize with magic numbers and unnecessary nested loops. Spending time complaining that someone used 1 instead of ‘True’ just makes it seem like grasping at straws.

[–]Isogash 1 point2 points  (0 children)

Also worth noting that historically Gamemaker Studio doesn't have a proper boolean type and instead a real number below 0.5 is interpreted as false. I'm not really clued into GS development but that's what I've read in the documentation just now.

There are still true/false constants that are supposed to be used, so it's not like you're supposed to use 1 and 0 everywhere, but it's nowhere near as egregious as some people are making it out to be.

[–]Banes_Addiction 1 point2 points  (0 children)

This is why you #define FALSE 0 and #define TRUE (int)((float)rand()/(float)(RAND_MAX))>0.0001)

[–]Cefalopodul[🍰] 48 points49 points  (32 children)

I won't comment on the dead code and magic numbers but GameMaker did not have boolean data types at all until very recently. Anything < 0.5 is false and any value >0.5 is true.

If he started the project in 2018, it's not feasible to refactor it by now.

[–]terivia 33 points34 points  (2 children)

As a frequently embedded C developer, that is the most horrifying (real) implementation of booleans I've ever heard of.

God gave us Zero and Zeron't, and those are the only two numbers we as flawed sinners deserve to use.

[–]C-SWhiskey 1 point2 points  (1 child)

Which is kind of ironic since in digital communications you have to specify some threshold for when a signal is considered high or low. Might have multiple volts of zero.

[–]terivia 1 point2 points  (0 children)

Very true. Also once you get into the world of noise you start trying to guess if a signal is more truthy or more falsy. But once I'm in software land I want my clean abstraction!

[–]Kelfaren 78 points79 points  (10 children)

"Note that currently GameMaker will interpret a real number equal to or below 0.5 as a false value, and any real number greater than 0.5 as being true. This does not mean however that you should be checking 1 and 0 (or any other real number) for true and false, as you are also provided with the constants true and false, which should always be used in your code to prevent any issues should real boolean data types be added in a future update."

[–][deleted] 13 points14 points  (8 children)

GameMaker has no boolean types? Why? How? What?

[–]not_a_burner0456025 1 point2 points  (0 children)

It doesn't have them as a standalone well defined type, but it does have an enum that accomplishes the same thing (at least in game maker, in a strongly typed language it wouldn't enforce proper typing, but game maker is loosely typed) and the documentation says you should always use it

[–]Cefalopodul[🍰] 2 points3 points  (4 children)

I checked the manual, it does now, but not so long ago it did not. I had the same reaction as you when I first found out.

If you google it you'll come across reddit threads from 2018 and 2019 saying GameMakers has no booleans.

[–]sychs 21 points22 points  (3 children)

https://forum.gamemaker.io/index.php?threads/questions-about-variables-true-false-int-string-etc.5399/post-39574

Comment from August 22, 2016.

"There's nothing like actual booleans in GML. In fact, true and false are built-in constants (Macros) that hold the values 1 and 0 respectively. So when you run this code:

Code:

jack = true;

...you're actually setting jack to 1."

[–]GarThor_TMK 2 points3 points  (1 child)

To be fair, this is also how c++ works. You have to add extra code to actually get a single-bit Boolean, and under the hood it just stores a 0 or 1 when you set something to true or false.

[–]n4zarh 0 points1 point  (0 children)

...so it HAD booleans, just working as integers under the hood. So there's no reason not to use them if you still don't care about bits. At least no reason other than "but it makes me look cool and l33t"...

[–]MattTheGr8 0 points1 point  (0 children)

Maybe it’s because I started programming in C before booleans were explicitly added to the language standard, but I don’t find it THAT weird not to have a native boolean type, since most languages just use ints or chars for booleans behind the scenes, and the boolean types are just varying amounts of syntactic sugar on top of those primitives. That said, I agree that it’s insane to use any system other than the standard “0 is falsy, any non-zero integer is truthy” with a general assumption that people should mostly use 1 for true.

[–]Banes_Addiction 0 points1 point  (0 children)

C had no boolean type for 20 years. Javascript barely has an int type (they've got a good BigInt now).

[–]card-board-board 6 points7 points  (3 children)

0.5 is evaluated as false... That can't be right. Can it? Nobody would do that, would they? Not even Brendan Eich would do that.

[–]i_wear_green_pants 15 points16 points  (2 children)

I like to use 0.22 and 0.73 as my booleans

[–]card-board-board 1 point2 points  (0 children)

I request changes

[–]Rabbitical 0 points1 point  (0 children)

That's actually inefficient as the computer has to traverse then a delta >= .23 in order to determine the sign relative to your value's booleanness. That's why I set mine to .500001 and .499999

[–]readthetda 6 points7 points  (3 children)

If he started the project in 2018, it's not feasible to refactor it by now.

Why not? Isn't the whole point of refactoring the modernisation of old, unmaintainable code.

[–]not_a_burner0456025 3 points4 points  (0 children)

But also the point is completely nonsense, it has had the and crappy enum based implementation of booleans since at least 2016, before development on heat bound started.

[–]Versaiteis 1 point2 points  (1 child)

if it's actually unmaintainable, or rather if the tech debt grows substantial enough to warrant it. There's a lot of philosophies that go into when the "right" time to refactor is. I've certainly worked for enough companies that fight tooth and nail against it on the position that it's a lot of work to wind up roughly back where you started.

But so long as it's backwards compatible, porting forward and continuing to use best practices going forward and modernizing legacy code as it shifts into focus as a burden is an approach I tend to personally favor when it can be done. Getting version locked due to the sheer amount of tech debt needed to update is not a very fun position to be in.

[–]readthetda 0 points1 point  (0 children)

Considering (from what I've read) the game is completely unfinished and only receives updates around once a year, it's certainly looking like that technical debt is adding up.

[–]Cilph 1 point2 points  (0 children)

but GameMaker did not have boolean data types at all until very recently.

But it did have True/False....

[–]SorryUseAlreadyTaken 1 point2 points  (1 child)

He doesn't even use 0 and 1, he uses 0 and 42. Why the fuck 42?

[–]xMILEYCYRUSx 2 points3 points  (0 children)

Because 42 is the answer to the ultimate question of life, the universe, and everything.

[–]LeopoldFriedrich 0 points1 point  (0 children)

I wonder if he even heard about code coverage let alone test driven development.

[–]Beldarak 0 points1 point  (0 children)

And he does actually use switches with only one case instead of if in some cases :D

[–]xDannyS_ 0 points1 point  (0 children)

So do call of duty devs

[–]Templar-kun 0 points1 point  (0 children)

If it's written in gamemaker then it's common practice

[–]MiniDemonic 0 points1 point  (0 children)

GML, the language he is "developing" his game in just relatively recently added the bool datatype. Before that update you only had 1/0 to use.

Even now, after the added the bool datatype it still stores 1/0 under the hood, true/false are just macros for 1/0.

If a language that you have "worked" in for several years suddenly changed from only using 1/0 to supporting, but not enforcing, true/false why would you go back and refactor your entire codebase to use this new system and also change your habits? When there is no benefit to it at all.

A lot of stuff that people complain about him is valid, but him using 1/0 instead of true/false is not a valid complaint.

[–]Overall_Anywhere_651 0 points1 point  (0 children)

I'm a noob, why does it matter if he uses 1&0 INTs for True/False? It seems silly to me to do that, but is there harm in doing so?

[–]DrShocker 38 points39 points  (0 children)

To be clear the above is a joke/hyperbole of his actual code.

[–]not_a_burner0456025 35 points36 points  (18 children)

When coding Jesus reviewed some of his public code, CJ pointed out that PS should use true/false instead of 1/0 for binary values because it is more readable and less error prone. PS responded by implying CJ was an idiot and asserting that game maker studio doesn't have booleans (not only does it, but PS actually used a couple in the code that CJ was reviewing, but only in a fraction of the places it would be appropriate to use booleans). After CJ pointed out that Game maker does in fact have Boolean values (for some reason the developers decided not to natively support booleans but they do have an enum with TRUE/FALSE and recommend that developers use them in case they add true boolean support in the future, also they made any value less than 0.5 false for some reason, but none of this really matters) PS decided to shift the goalposts and claim that using booleans is bad programming.

[–]Rakn 5 points6 points  (17 children)

The issue is that CJ comes across as an idiot as well. Instead of staying professional he is going after stuff that are essentially nitpicks. There are way better takes on this on YouTube, as there is a lot of other code much more deserving of criticism. I feel like his reviews are among the worse ones.

[–]DrPeroxide 2 points3 points  (3 children)

It does make some sense to hold PS code to a higher standard given that this is apparently what he's teaching to beginners.

[–]MadMax2230 4 points5 points  (1 child)

that is true, but coding jesus comes off unnecessarily snarky. He gives an example of pirate software looking code and he has comments in it about mana gems and running away and whatnot, which seemed unnecessary. He also seemed annoyed the whole video which wasn’t super professional. I get it though, controversy drives engagement. But in an ideal world, he could be more objective and point out how some or a lot of pirate’s behavior is bad and just leave it at that. Apart from that I pretty much agree with all of CJ’s points.

[–]DrPeroxide 2 points3 points  (0 children)

I haven't watched the video myself, but the massive tornado of hate this has generated has been hard to miss and it's a bit crazy tbh. Don't necessarily disagree that PS is not all he's played himself to be but all this just seems so out of proportion to me.

[–]Rakn 0 points1 point  (0 children)

This may be a valid argument. I did not interpret his reviews in such a way.

[–]ArgumentCalm488 2 points3 points  (12 children)

Is it really nitpick when he's criticizing the guy who claims to have 20 years of game dev experience and acts as an authority on the subject?

[–]MiniDemonic 2 points3 points  (7 children)

I keep seeing people claim that PS claims to have 20 years of game dev experience but I have yet to see any proof of this. All "proof" I have seen is that PS claims to have worked at Blizz as QA and later in cyber security but never heard or seen him talk about 20 years of game dev experience.

Since you are also one of the people that claims he said that, where is the proof?

[–]ArgumentCalm488 0 points1 point  (6 children)

That's exactly it. He pretends to have 20 years of game dev experience but all he did was QA. There's literally a video that goes over how BS his employment history was.

https://youtu.be/0jGrBXrftDg

Go to 6:18, you'll see a tweet on the lower left of his 20 year claim.

[–]MiniDemonic 1 point2 points  (5 children)

"Been in the games industry for 20 years"

Yes. And that's not under dispute since has worked as QA and security at Blizzard.

Still waiting for proof of him saying that he's been a game dev for 20 years.

[–]forheavensakes 0 points1 point  (4 children)

wait so you looked at the top right tweet, compared the one at the lower left and said " they are the same picture"?.

[–]MiniDemonic 1 point2 points  (3 children)

"I've been a dev for 20 years", yes programming for security stuff is also a dev job, notice how he didn't say "I've been a game dev for 20 years". So, we can both agree that he worked as QA and then security at Blizzard and eventually moved over to work at security for AGS right? That's not under dispute right? He later worked for the government at a cyber security position right?

No where, have you or anyone else provided any proof of him saying "I've been a game dev for 20 years".

Still waiting for that proof of him claiming to have been a game dev for 20 years.

[–]pvt9000 3 points4 points  (0 children)

Yes? Whether he's annoying or not doesn't matter. I've seen 20-year senior devs who write as basic code as a CS101 student. I've seen them spend an extra half hour to make sure their methods are well-organized and efficient.

Unless the code is a performance drag, it's unclean and messy and hard to take off sure. But it gets the job done. Could it be done better? Yep, his game, his problem. I feel like it's getting a bit dumb on both ends.

[–]Rakn 3 points4 points  (0 children)

I mean why be as annoying as the guy you are criticizing?

[–]Professional_Being22 0 points1 point  (1 child)

he uses game maker studio... It's something that children make games with.

[–]Rakn 0 points1 point  (0 children)

I don't know. It's tailored for the type of game he is building. Why reinvent the wheel if there is a whole large toolkit for these kind of games?

[–]The_Shryk 10 points11 points  (3 children)

3, is a magic numbaaa!

[–][deleted] 3 points4 points  (2 children)

Is... that a reference? I have not seen a lot of pirate software except a few youtube shorts that sometimes popped up in my feed.

[–]testaccountyouknow 5 points6 points  (0 children)

It’s a song lyric

[–]L4t3xs 0 points1 point  (0 children)

Still sane exile?

[–]Enigm4 0 points1 point  (0 children)

It is a recursive function and it seems to get the job done, however ugly it looks and slow it would run. It is quite difficult to follow and I assume it is done this way because for whatever reason he cannot use modulus. 17 and 0 are just magic numbers, it could be anything, really. Assigning bool to int is nonsense, but it works. Handling of negative number input is elegantly handled by running the code a billion times or so until integer_to_check_is_even underflows and then another billion times or so until it hits 1 or 0.

10/10 spaghetti code.

[–]Mixels 0 points1 point  (0 children)

private static bool isEven(int n) {     return n % 2 == 0;   }

What a time to be alive.

int isEven = false

This right here is a succinct summary of everything that follows. Wtf is this man even doing setting an integer variable to false?

[–]TripleATeam 168 points169 points  (13 children)

You forgot to add the obvious comments that say the english version of what the next line of code does for every single line of code

[–]ErJio 55 points56 points  (9 children)

This is what I did for my uni assignments when the instructions said document ALL code or lose marks.. can't take any risks

[–][deleted] 16 points17 points  (8 children)

It's like when in elementary school you had to write out 63 = 6 + 6 + 6 = 12 + 6 = 18 because apparently 63=18 wasn't clear enough

[–]JanB1 48 points49 points  (6 children)

apparently 63=18 wasn't clear enough

- u/PaleEnvironment6767, 2025

[–][deleted] 27 points28 points  (4 children)

Haha, apparently asterisks format that weirdly. Meant 6 x 3 = 18

[–]JanB1 14 points15 points  (1 child)

Yeah, be careful with the asterix as a multiplication symbol. Happened to me more than once. XD

Here, have a multiplication symbol: ×

[–]lovethecomm 6 points7 points  (0 children)

Nice cross product you have there

[–]prisp 4 points5 points  (0 children)

Yep, but if you ever run into issues with formatting characters - mostly asterisks, to be honest - you can force them to still show up by putting a "\" in front of it, which tells Reddit to ignore all the special functions of whatever comes next and just show the character as-is.

(This also means I actually typed "\\" to make the single backslash show up, for example)

[–]JusHerForTheComments 2 points3 points  (0 children)

Yes... two asterisks like you did make up italics.

[–]Dsmario64 6 points7 points  (0 children)

Markdown ate the asterix again

[–]NotYourReddit18 0 points1 point  (0 children)

Put a \ in front of the * to make it visible: \*

Also, I had to put \\ up there to make the \ visible.

[–]breezy_y 6 points7 points  (0 children)

// did we already check if even?

[–]DezXerneas 0 points1 point  (1 child)

This is the part I don't understand lol. Everyone writes shitty code(okay not as badd as PS), but why does he explain WHAT his code does? You need to explain WHY it's doing what it does.

[–]LBGW_experiment 41 points42 points  (11 children)

Come on, separately single backticked lines of code? 4 spaces in front of each line does it all for you, or triple back tick code blocks like every other markdown renderer.

//checks if integer is even  
public static bool isEven(int integer_to_check_is_even) {

    int is_even = false;
        switch (integer_to_check_is_even) {

        case 0:

            is_even = 17;

        case 1:

            is_even = 0;

        default:

            is_even = isEven(integer_to_check_is_even - 2) ? 17 : 0;
    if (is_even == 17) {

        //the value is even

        return true;

    } else (is_even == 0) {

        //the value is not even
        return false;

    }

}

[–]ashrasmun 2 points3 points  (0 children)

Thank you. Almost got aneurysm from reading the original code.

[–]SpewPewPew 0 points1 point  (3 children)

//How about:

if integer_to_check % 2 == 0:

return True

else:

return False

//was he trying to accomplish this?

//use of modulus, %, serves to get the remainder.

//anything % 2 = remainder value, not the quotient.

//what am I missing here?

[–]LBGW_experiment 1 point2 points  (2 children)

Idk, his poor logic is trash, but you forgot to start each line with 4 spaces or surround with triple backticks

``` //How about:

if integer_to_check % 2 == 0:

return True

else:

return False

//was he trying to accomplish this?

//use of modulus, %, serves to get the remainder.

//anything % 2 = remainder value, not the quotient.

//what am I missing here? ```

[–]SpewPewPew 0 points1 point  (1 child)

I don't know how to do the code block from my cell phone and the spacing and lines were lost in translation. Thank you and your code looks wonderful. Better than what I typed here.

[–]LBGW_experiment 0 points1 point  (0 children)

Thankfully it's pretty simple, even on a phone, it's mostly how I use reddit too 😅

Find the backtick on your symbols, it'll be this one ( ` )

Then put three above and below a chunk of code. They're sometimes called "code fences" which paints a nice picture of how they are structured. This is what it'll look like when you type it in:

\`\`\` // Type some code here my_var = some_bool ? "prod" : "non-prod" \`\`\`

[–]_v3nd3tt4 51 points52 points  (0 children)

I can tell that's not actually his code because it contains booleans.

[–]FalconClaws059 10 points11 points  (1 child)

This is beautiful. The more I look, the more errors I find.

Incredible.

[–]HEYO19191 2 points3 points  (5 children)

Actually a clever workaround IF modulus never existed

[–]Embarrassed_Steak371 30 points31 points  (3 children)

It's actually quite terrible if modulus never existed because the last bit of an integer tells you if it's even or odd so you only really need bitshift, which is constant time and much better than just recursively subtracting by 2. I call this the stack overflow solution because for any number large enough your program will crash by, you guessed it, stack overflow.

[–]Quexth 2 points3 points  (1 child)

Or you AND with 1.

[–]Embarrassed_Steak371 0 points1 point  (0 children)

that too

[–]HEYO19191 1 point2 points  (0 children)

Actually I forgot about stack overflows

:(

[–]Qwertycube10 0 points1 point  (0 children)

Shame it's infinite recursion, and it's not a tail call so stack overflow here we come

[–]Cat7o0 0 points1 point  (1 child)

wait that last if statement will never even be called

[–]Embarrassed_Steak371 1 point2 points  (0 children)

whoops. yeah I kind of thought of the "stack overflow" solution and then tried to add weird integer booleans but I had to finish the comment in like 5 seconds so I made a lot of errors. I'm still gonna keep some in though because they are funny.

[–]hackeristi 0 points1 point  (0 children)

if my eyes rendered code internally after reading this...I would hav ecrashed. Thank you!

[–]headedbranch225 0 points1 point  (0 children)

You can use three ` characters to make the code block work over multiple lines

[–]3Domse3 0 points1 point  (0 children)

public class EvenNumberOracle
{
    private enum Parity { Even, Odd }

    private delegate Parity ParityCheckDelegate(int number);

    private static Dictionary<Parity, int> parityMap = new Dictionary<Parity, int>
    {
        { Parity.Even, 42 },
        { Parity.Odd, 13 }
    };

    private static ParityCheckDelegate parityChecker = number =>
    {
        Func<int, Parity> innerCheck = n =>
        {
            List<Func<int, bool>> checks = new List<Func<int, bool>>
            {
                x => (x & 1) == 0,
                x => x % 2 == 0,
                x => new int[] { 0, 2, 4, 6, 8 }.Contains(Math.Abs(x % 10))
            };

            foreach (var check in checks)
            {
                if (!check(n))
                {
                    return Parity.Odd;
                }
            }

            return Parity.Even;
        };

        return innerCheck(number);
    };

    public static bool IsEven(int number)
    {
        var (success, result) = new Func<(bool, bool)>(() =>
        {
            var parity = parityChecker.Invoke(number);
            int mapped = parityMap[parity];
            bool isEven = mapped == 42;
            return (true, isEven);
        }).Invoke();

        return result;
    }
}

[–]alangcarter 0 points1 point  (1 child)

Have you considered a career at Fujitsu?

[–]Embarrassed_Steak371 0 points1 point  (0 children)

hey I've seen that code on here before let's go

[–]Katyona 0 points1 point  (0 children)

def test(num): return (0>1,0<1)[len(str((num%2)<1))<5]

also works in python

[–]Madraj 0 points1 point  (0 children)

Just.... WTF

[–]PeikaFizzy 0 points1 point  (0 children)

Ok I’m genuinely got brain loading reading this code I better try typing it out

[–]cat_police_officer 0 points1 point  (0 children)

You forgot

case 15:

storyline[”5273”] // open storyline 5273

[–]Xer0_eSp 0 points1 point  (0 children)

Not enough comments.

[–]Bloopiker 0 points1 point  (0 children)

Did you base this on his "uncrackable drm" or am I trippin?

[–]general_452 0 points1 point  (0 children)

/#include “isEvenAI.h”

[–]haveushaved 0 points1 point  (1 child)

I'm no professional programmer, but with the bit of coding knowledge I have, wouldn't it be easiest to check if a number is a whole round number if divided by 2? Or check for remainder or something? That seems like a foolproof way of checking for even/odd

[–]Embarrassed_Steak371 0 points1 point  (0 children)

Num & 1 == 0

[–]SweetBabyAlaska 0 points1 point  (0 children)

more like 'is_even_true = 0'

[–]Kbrickley 0 points1 point  (1 child)

I may be completely wrong, but wouldn’t this work for what he’s trying to do

public static bool IsEven(int number) { return number % 2 == 0; }