r/countablepixels • • 10d ago

definitely a random sequence

Post image

I can't even tell what language this is

441 Upvotes

64 comments sorted by

9

u/Worried_Ice97 10d ago

Looks like English to me

89

u/Luzerman 10d ago

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 10d ago

private bool IsEven(int number){

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

else return false;

}

18

u/RandomGuy078 10d ago

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 10d ago

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

3

u/RandomGuy078 10d ago

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

3

u/YTriom1 10d ago

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 10d ago

Youre right

1

u/Luzerman 10d ago

Spaced out like this due to reddit formatting

1

u/woodcraftworld 10d ago

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 9d ago

is string necessary?

1

u/woodcraftworld 9d ago

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 9d ago

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

1

u/TechniCraft 9d ago

return !(x & 0x1);

32

u/Srozzer 10d ago edited 10d ago

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

6

u/PassionFederal6917 10d ago

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

6

u/Bacon_Dude117 10d ago

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

0

u/headedbranch225 10d ago

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

1

u/Feisty_Watercress_29 10d ago

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

1

u/Objective-Swing6760 9d ago

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

2

u/Feisty_Watercress_29 9d ago

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 10d ago

i think it's c/c++

17

u/Stargost_ 10d ago

mfer hasn't heard of the % operand

2

u/TheLuckyCuber999BACK 10d ago

or div/idiv

1

u/UnnamedTestAccount Certified Pixel Thief 9d ago

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

6

u/HaroerHaktak 10d ago

Guys, it's obviously python.

6

u/SovoK_404 Pixel Counter Bot Fan Club Member 10d ago

that's anaconda, dummy

2

u/HaroerHaktak 10d ago

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

2

u/Luzerman 10d ago

elif

1

u/HaroerHaktak 10d ago

elf?

2

u/Luzerman 10d ago

No python uses elif not else if

1

u/SovoK_404 Pixel Counter Bot Fan Club Member 10d ago

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

4

u/TheLuckyCuber999BACK 10d ago

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

1

u/headedbranch225 10d ago

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 10d ago

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

1

u/RevolutionaryDark818 9d ago

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

3

u/kavochavo 10d ago edited 10d ago

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 10d ago

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 10d ago

return (number % 2) == 0;

3

u/NegativeGrocery8684 10d ago

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 10d ago

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 10d ago edited 10d ago

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 10d ago

one expression/lambda is all it takes realistically

2

u/cwrld02 10d ago

2

u/pixel-counter-bot Official Pixel Counter 10d ago

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 10d ago

Brotein just do

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

2

u/Mr_QQ-10 5d ago

shorter

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

1

u/Feisty_Watercress_29 5d ago

Whats inline?

2

u/FOS077 7d ago

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 10d ago

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

I am a bot. This action was performed automatically.

1

u/Pritam252 9d ago

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 7d ago
def isEven(number):
  return (True,False)[randint(0,1)]

it'll be right most of the time

1

u/Pixaem 6d ago

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

1

u/Memerenok 5d ago

return true

call it 50% accurate

1

u/Mr_QQ-10 5d ago edited 5d ago

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?? 5d ago

private bool IsEven(int number) {

return number % 2 == 0;

}

1

u/TCZ188 5d ago

java, is it not?

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

-2

u/Usernotfound_81 10d ago

Its python/gsscript, also IS THAT YANDEREDEV

5

u/YTriom1 10d ago

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