r/countablepixels • • Oct 26 '26

definitely a random sequence

Post image

I can't even tell what language this is

442 Upvotes

65 comments sorted by

9

u/Worried_Ice97 Oct 27 '26

Looks like English to me

89

u/Luzerman Oct 27 '26

It dosen't even matter what language since a lot could run this without any issues...

Well, "without any issues" as in it WILL run the code, at least.

25

u/Luzerman Oct 27 '26

private bool IsEven(int number){

if (floor(number/2) == number/2) return true;

else return false;

}

18

u/RandomGuy078 Oct 27 '26

Hell, you can simplify further with "return number%2" since modulo 2 returns either 1 if odd and 0 if even so make your function isOdd and youre good or "return !(number%2)" but I personnally dont like that solution

11

u/YTriom1 Oct 27 '26

or make it return number % 2 == 0 so it returns a boolean

3

u/RandomGuy078 Oct 27 '26

Yeah but most languages have implicit boolean conversions for numbers no? Althought this would make it more type secure

3

u/YTriom1 Oct 27 '26

not really, some languages don't even define the return type so it'll see a number and just literally return the number itself

3

u/RandomGuy078 Oct 27 '26

Youre right

1

u/Luzerman Oct 27 '26

Spaced out like this due to reddit formatting

1

u/woodcraftworld Oct 27 '26

I wrote this shit even function in python. It works, but it's shit.

if str(float(int(number/2))) == str(float(number/2)):

1

u/Minute-Report6511 Oct 28 '26

is string necessary?

1

u/woodcraftworld Oct 28 '26

Probably not, I'll admit to you that as a guy who works primarily in C#, I didn't know how to do it in python, tried to do it without the float() on the int() and it didn't work, so bing search the correct way to do it.

1

u/Inevitable_Spite5510 Oct 27 '26

return (floor(number/2) == number/2)

1

u/TechniCraft Oct 27 '26

return !(x & 0x1);

32

u/Srozzer Oct 27 '26 edited Oct 27 '26

It's Java. Wait maybe it isn't, the data type is bool instead of boolean I'm probably wrong.

6

u/PassionFederal6917 Oct 27 '26

Huh, I thought it was C++. I did try to learn a bit of that

6

u/Bacon_Dude117 Oct 27 '26

Im leaning C# tbh. Don't quote me on this I'm terrible at C#

0

u/headedbranch225 Oct 27 '26

C# has very similar syntax and a lot of stuff to java, but even more yucky

1

u/Feisty_Watercress_29 Oct 27 '26

Nah c++ uses brackets in if(){};

1

u/Objective-Swing6760 Oct 27 '26

You actually do not need them If it is only one line

2

u/Feisty_Watercress_29 Oct 28 '26

Ohh okay, still probably not C++ because you can't reach values in functions in C++, thus no need for making it private (use classes for it)

-2

u/SovoK_404 Pixel Counter Bot Fan Club Member Oct 27 '26

i think it's c/c++

17

u/Stargost_ Oct 27 '26

mfer hasn't heard of the % operand

2

u/TheLuckyCuber999BACK Oct 27 '26

or div/idiv

1

u/UnnamedTestAccount Certified Pixel Thief Oct 27 '26

or if you got tokens to burn, have an AI model evaluate it /s

6

u/HaroerHaktak Oct 27 '26

Guys, it's obviously python.

6

u/SovoK_404 Pixel Counter Bot Fan Club Member Oct 27 '26

that's anaconda, dummy

2

u/HaroerHaktak Oct 27 '26

Oh, now that I am wearing my glasses, I see it

2

u/Luzerman Oct 27 '26

elif

1

u/HaroerHaktak Oct 27 '26

elf?

2

u/Luzerman Oct 27 '26

No python uses elif not else if

1

u/SovoK_404 Pixel Counter Bot Fan Club Member Oct 27 '26

it could be else if as well but in different syntax (else:\nif)

4

u/TheLuckyCuber999BACK Oct 27 '26

C# I think. Looks like a C family but C/C++ don't have private as function definition afaik.

1

u/headedbranch225 Oct 27 '26

Could also be java, I think at least, but I haven't done much java

Its basically C# but not made by Microsoft and actually good

1

u/Techmej Oct 27 '26

It’s definitely Java or C#. The syntax matches it too perfectly

1

u/RevolutionaryDark818 Oct 28 '26

C# I believe, not java because java spells boolean as "boolean" and not "bool"

3

u/kavochavo Oct 27 '26 edited Oct 27 '26

ts has nothing to do with random sequences, this is a user defined function that checks if a given number is even but does that in the silliest way imaginable

4

u/Prokid5634_YT Oct 27 '26

I haven't coded in several months, but if I remember correctly, it should really only take maybe 3-5 lines to do this correctly lmao

12

u/Number_3434 Oct 27 '26

return (number % 2) == 0;

3

u/NegativeGrocery8684 Oct 27 '26

less than a year to forget how to write the logic of one of the most basic function possible in any language? programming is kind of like riding a bicycle, once you know how to think like a programmer you don't really forget, regardless of syntax.

1

u/Prokid5634_YT Oct 27 '26

That's the problem; I may have dabbled in a language, but I never really learned how ti think like a programmer.

2

u/NegativeGrocery8684 Oct 27 '26 edited Oct 27 '26

im sorry, i jumped to a conclusion and made a snide comment. when i was starting out, the one thing that really clicked with me was when i was taught to write out what i want something to do in plain english, then breaking it down into pseudo-code, and then finally putting it into real syntax. if you ever pick it up again, i highly recommend looking into this method. hope you have fun learning, too.

1

u/wi-finally Oct 27 '26

one expression/lambda is all it takes realistically

2

u/cwrld02 Oct 27 '26

2

u/pixel-counter-bot Official Pixel Counter Oct 27 '26

The image in this post has 137,180(361×380) pixels!

I am a bot. This action was performed automatically.

2

u/Feisty_Watercress_29 Oct 27 '26

Brotein just do

bool isEven(double x){ if((x % 2) == 1){return false;} else{return true;}

2

u/Mr_QQ-10 Nov 01 '26

shorter

inline bool isEven(double x) { return x % 2 > 0; }

1

u/Feisty_Watercress_29 Nov 01 '26

Whats inline?

2

u/Mr_QQ-10 22d ago

makes the compiler compile the function directly rather than making it an actual function

so

bool x = isEven(5);

becomes

bool x = 5 % 2 > 0;

2

u/FOS077 Oct 29 '26

Ahh, the famous YandereDev "There's gotta be a better way to do this" tweet lmao
I only recognize it because I'm in an indie dev server where we have this pinned and constantly point to it when someone starts getting impostor syndrome lol

2

u/pixel-counter-bot Official Pixel Counter Oct 26 '26

The image in this post has 137,180(361×380) pixels!

I am a bot. This action was performed automatically.

1

u/Pritam252 Oct 28 '26

It's probably C#, because the method name starts with a capital (unlike Java which has method names starting with a lowercase), and the type is bool, not boolean.

1

u/player_314159265 Oct 30 '26
def isEven(number):
  return (True,False)[randint(0,1)]

it'll be right most of the time

1

u/Pixaem Oct 30 '26

if(number % 2 == 0){ return True; }

1

u/Memerenok Oct 31 '26

return true

call it 50% accurate

1

u/Mr_QQ-10 Nov 01 '26 edited Nov 01 '26

programmer here

  • it's not java, boolean type is named "Boolean" in java
  • it's not c++, c++ uses private/public sections, not modifers (see below)
//java/c#
public void foo() { }
public void bar() { }

//c++
public:
    void foo() { }
    void bar() { }

this is c#, types match (bool, int), it is c-style, and public/private are modifers

1

u/BFcoolbot WHERE ARE THE PIXELS?? Nov 01 '26

private bool IsEven(int number) {

return number % 2 == 0;

}

1

u/TCZ188 Nov 01 '26

java, is it not?

oh wait the “book” instead of “boolean”… maybe C#?

-2

u/Usernotfound_81 Oct 27 '26

Its python/gsscript, also IS THAT YANDEREDEV

5

u/YTriom1 Oct 27 '26

python doesn't use semicolons or curly braces, also doesn't have var defining, and has elif not else if.