>Makes you game run in 5 fps

>Makes you game run in 5 fps

Schizophrenic Conspiracy Theorist Shirt $21.68

Homeless People Are Sexy Shirt $21.68

Schizophrenic Conspiracy Theorist Shirt $21.68

  1. 3 weeks ago
    Anonymous

    what is the correct way

    • 3 weeks ago
      Anonymous

      Using the modulo operator is the normal way to do it.

    • 3 weeks ago
      Anonymous

      Modulo is ideal, but even intentionally trying to make it shitty the worst I can think of is divide by 2 and check if variable type is integer or float - which wouldn't even work in half the languages

      • 3 weeks ago
        Anonymous

        Have you even read IEEE 754, you troglodyte.

      • 3 weeks ago
        Anonymous

        You can just convert the number to binary and check if the first bit is a 1 (odd) or a 0 (even).

        No maths necessary, the info is in the number itself, you just need to look at the number in binary,

    • 3 weeks ago
      Anonymous

      return number & 1;

      • 3 weeks ago
        Anonymous

        Doesn't work if number is negative.

        • 3 weeks ago
          Anonymous

          >hello I'll take -3 apples
          literally only useful in your CS class bud

          • 3 weeks ago
            Anonymous

            Sure, until the pilot of a plane using the FCS program you wrote decides to take in the scenery flying low over the Dead Sea...

        • 3 weeks ago
          Anonymous

          cout("-'"positiveinterget)

          😀

        • 3 weeks ago
          Anonymous

          sign(x) * (abs(x) & 1);
          what now huh

          • 3 weeks ago
            Anonymous

            At that point you could also just abs(x) & 1 instead.

        • 3 weeks ago
          Anonymous

          >it's a Ganker talks about programming episode

          it works in two's complement (basically everything)

          • 3 weeks ago
            Anonymous

            Wanna go ask Ganker about bideo games? It's pretty funny honestly.

    • 3 weeks ago
      Anonymous

      Languages vary but for most of them something like
      return abs(number)%2 == 0;
      will work.

    • 3 weeks ago
      Anonymous

      private bool IsEven(int n) => n % 2 == 0;

    • 3 weeks ago
      Anonymous

      If you want the fastest way for maximum FPS:

      private boolean isEven(int number) {
      Random random = new Random();
      return random.nextBoolean();
      }

      Most of the time it works all time.

    • 3 weeks ago
      Anonymous

      Modulo
      The most pseud way of doing it is to return !(number & 1)

    • 3 weeks ago
      Anonymous

      the entire code should be written as one line

    • 3 weeks ago
      Anonymous

      private bool IsEven(float number){
      for(int Number = 1; Number > 0; Number++, Number++)
      {
      if~~*int)number - Number != 0)){} esle {return true;}
      }
      return false;
      }

    • 3 weeks ago
      Anonymous

      #include <limits.h>

      bool isEven(int number) {
      bool arr[UINT_MAX] = { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
      0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
      1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
      0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
      1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
      0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
      1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
      0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
      1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
      0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
      1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
      0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
      1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
      0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
      1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
      0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
      1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
      0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
      1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
      0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
      1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
      0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
      1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
      0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0
      };
      return arr[number];
      }

      • 3 weeks ago
        Anonymous

        Fast and efficient. Modulo-gays in shambles rn

    • 3 weeks ago
      Anonymous

      private bool isEven(int number) {

      if (number == 0) {
      return true;
      } else if (number < 0) {
      return !isEven(number+1);
      } else {
      return !isEven(number-1);
      }

      }

    • 3 weeks ago
      Anonymous

      That would be this way:

      let number = 5
      function IsEven(x){
      if(x !== odd){
      return true
      }
      }

      console.log(isEven(number))

    • 3 weeks ago
      Anonymous

      If you really want the correct answer to this problem you should avoid all Black personlicious languages and only use HolyC:

      I32 IsEven(I32 num)
      {
      return (num >> 1) << 1 == num;
      }

      • 3 weeks ago
        Anonymous

        Huh, that's actually a pretty clever one. That might even end up faster than modulo on some hardware.

    • 3 weeks ago
      Anonymous

      if number=Even true
      else false

      • 3 weeks ago
        Anonymous

        return number=Even

        • 3 weeks ago
          Anonymous

          In english, doc

          • 3 weeks ago
            Anonymous

            public boolean isEven(int n){
            return n%2==0;
            }

    • 3 weeks ago
      Anonymous
      • 3 weeks ago
        Anonymous

        why random.next(2) and not 1?

      • 3 weeks ago
        Anonymous

        >not creating a Number object
        >not creating an Api_URL object
        >not creating an api_url_with_number object
        >not using getters and setters
        >not using a randomFactory
        >ex instead of CatchedExceptionHttpClientError
        You will never be hired

        • 3 weeks ago
          Anonymous

          >not using getters and setters
          evil
          should be avoided at all costs
          https://www.yegor256.com/2014/09/16/getters-and-setters-are-evil.html

      • 3 weeks ago
        Anonymous

        Infantilized error message from nu-devs sends me into a frothing rage every time.

      • 3 weeks ago
        Anonymous

        I hate C# so much.

    • 3 weeks ago
      Anonymous

      import isEven;
      if (isEven(number)) return true;
      else return false;

    • 3 weeks ago
      Anonymous

      function isEven(number) {
      const isOdd = (num) => num % 2 !== 0;
      const convertToBinary = (num) => parseInt(num.toString(2));
      const reverseBinaryDigits = (binaryNum) => parseInt(binaryNum.toString().split('').reverse().join(''), 2);
      const addOne = (num) => num + 1;
      const isOddInBinaryReversed = (num) => reverseBinaryDigits(convertToBinary(addOne(num*~~;
      return !isOddInBinaryReversed(number);
      }

      const result = isEven(6);
      console.log(result);

    • 3 weeks ago
      Anonymous
      • 3 weeks ago
        Anonymous

        Whoops, fixed

    • 3 weeks ago
      Anonymous

      > so many serious answers
      Shit thread.

    • 3 weeks ago
      Anonymous

      timer = 0
      timer += 1
      print(timer)
      print(x)

      while (timer != 0){
      timer + 1
      print(timer)
      print(x)

      if (x == 0){
      timer = -1
      }
      print(timer)
      print(x)
      }
      print(timer)
      print(x)

    • 3 weeks ago
      Anonymous

      if (number_string[len(number_string)-1] == 1 or number_string[len(number_string)-1] == 3 or number_string[len(number_string)-1] == 5 or number_string[len(number_string)-1] == 7 or number_string[len(number_string)-1] == 9): return false

    • 3 weeks ago
      Anonymous

      just use the ChatGPT api in your game to check the number and fetch the answer, you can then advertise that your game is using the latest AI tech, this will greatly impress women and investors

    • 3 weeks ago
      Anonymous

      if x % 2 == 0

    • 3 weeks ago
      Anonymous

      Here, simple and elegant

      def is_even(value):
      if value == 1:
      return False
      if value == 2:
      return True
      return not is_even(value - 1)

    • 3 weeks ago
      Anonymous

      Divide the number by 2 and check the reminder.

    • 3 weeks ago
      Anonymous

      if number % 2 == 0:
      return True
      return False

      • 3 weeks ago
        Anonymous

        Just directly return "number % 2 == 0" and you achieve the same thing.

  2. 3 weeks ago
    Anonymous

    All of this gets fixed by the compiler.

    • 3 weeks ago
      Anonymous

      shhh

    • 3 weeks ago
      Anonymous

      my FX6300 DOE???

    • 3 weeks ago
      Anonymous

      The compiler will optimize it.

      I've known far too many people that actually believe that.

    • 3 weeks ago
      Anonymous

      This should be easy to debunk just by playing the game. Not me, of course but surely someone has played the damn thing. Does it run well? Or is Starfield levels of "dude just upgrade your PC"?

    • 3 weeks ago
      Anonymous

      there is nothing to fix this is a known optimization

  3. 3 weeks ago
    Anonymous

    looks good to me

  4. 3 weeks ago
    Anonymous

    transcoded ass function

    • 3 weeks ago
      Anonymous

      >Bringing trannies up out of nowhere

  5. 3 weeks ago
    Anonymous

    It's more important that the programmer's understand the code OP. In fact this code could use more comments for better understanding in case someone else takes over the codebase.

    • 3 weeks ago
      Anonymous

      // manually inserted every single odd and even number because we're too dumb to use google

  6. 3 weeks ago
    Anonymous

    Could do

    x != x / 2 ? false : true

  7. 3 weeks ago
    Anonymous

    So this is the power of Github copilot

    • 3 weeks ago
      Anonymous

      The code in the image seems to be a method that is trying to determine if a given integer number is even or not. However, the approach used is highly inefficient and not scalable, as it relies on hard-coded checks for each number.

      A better approach would be to use the modulo operator, which gives the remainder of the division of two numbers. For any integer n, if n % 2 equals 0, then n is even; otherwise, it's odd. Here's how you can improve the method:

      java

      private boolean isEven(int number) {
      return number % 2 == 0;
      }

      This single line of code replaces the entire series of if-else statements and works for any integer value, not just the ones listed in the original method. It's also much more readable and maintainable.

      • 3 weeks ago
        Anonymous

        thanks ChatGPT

      • 3 weeks ago
        Anonymous

        >It's also much more readable and maintainable.

        This is false though. Someone not familiar with math doesn't know what the frick "%2 == 0" is doing, where the code in the OP is immediately clear to anyone, and it's easier to maintain in the future should certain numbers change their even/odd property, you just change the corresponding line without having to come up with a new algorithm.

        • 3 weeks ago
          Anonymous

          The code provided in the image suggests a misunderstanding of the concept of even and odd numbers, which are fundamental properties of integers that do not change over time. An even number is any integer that can be divided by 2 without leaving a remainder, and this property is universal and immutable for integers.

          In computer programming, the modulo operation (%) is a standard way to determine the remainder of a division. Specifically, number % 2 computes the remainder of number divided by 2. If the remainder is 0, the number is even; if it's 1, the number is odd.

          Using the modulo operation is the correct and efficient way to determine if a number is even, and it's a widely accepted convention in programming. The code you posted might be more immediately understandable to someone completely unfamiliar with programming or mathematics, but it's not practical for a real-world program for several reasons:

          Scalability: The provided code only works for numbers 1 to 22, and adding more would require additional lines of code for each new number. This is not maintainable for larger ranges of numbers.

          Correctness: Even and odd are not properties that change, and suggesting that they might ("should certain numbers change their even/odd property") is incorrect. As such, there's no need to plan for such changes when writing code.

          Performance: The hardcoded approach is also less efficient because it requires multiple conditional checks, which is slower than a single modulo operation, especially as the number of conditions grows.

          Best Practices: Using the modulo operation is a best practice in programming for this type of problem. It is a fundamental part of a programmer's toolkit, and understanding it is important for writing effective code.

          In summary, while the original code is straightforward, it is not a professional or practical approach to the problem. The modulo operation is the standard method used in programming for this purpose.

          • 3 weeks ago
            Anonymous

            [x] -Too verbose
            [ ] - Concise
            [ ] - Too terse

            • 3 weeks ago
              Anonymous

              The modulo operation is standard for checking even numbers because it's concise and works for all integers. The original code is not practical; it's not how even numbers are usually handled in programming.

          • 3 weeks ago
            Anonymous

            Subject: Regarding the Use of ChatGPT in Your Post

            Hello [User],

            I hope this message finds you well. I recently came across your post, and it seems that the content is generated by ChatGPT. While I appreciate the convenience and creativity that ChatGPT offers, I would like to encourage you to share your own thoughts and ideas in your posts.

            Engaging in authentic conversations and expressing personal perspectives contributes to a richer and more meaningful exchange of ideas. By using your own voice, you not only add a unique touch to your content but also foster a genuine connection with the community.

            Feel free to share your thoughts, experiences, or questions directly, and let's continue building a space where everyone's individuality shines through.

            Thank you for understanding, and I look forward to hearing more from you in your own words.

            Best regards,
            [Your Name]

            • 3 weeks ago
              Anonymous

              Subject: The Value of Integrating ChatGPT into Our Conversations

              Dear [Your Name],

              Thank you for your thoughtful message regarding the use of ChatGPT in my posts. I understand and appreciate the importance of authentic conversations and the expression of personal viewpoints within our community. However, I believe there is a significant value in integrating tools like ChatGPT into our discussions.

              ChatGPT, and similar AI technologies, offer us an expansive range of capabilities—from generating creative ideas to providing informative content that might not be readily available. This integration allows us to enhance our conversations with diverse perspectives and knowledge that we, as individuals, may not possess. It's not about replacing human interaction but enriching it.

              Furthermore, utilizing ChatGPT can also be seen as a form of personal expression. The way one chooses to use AI, the questions asked, and the modifications made to the generated content reflect individual thought processes and creativity. It's a collaborative effort between human and machine, leading to unique contributions that might not have been possible otherwise.

              The goal should not be to segregate human and AI contributions but to find a harmonious balance that leverages the best of both worlds. By doing so, we can create a more inclusive, informative, and innovative community space.

              Let's embrace the potential of what we can achieve together, combining our individual insights with the vast possibilities offered by AI.

              Looking forward to continuing our engaging and enriched conversations.

              Best regards,
              [User]

        • 3 weeks ago
          Anonymous

          >in the future should certain numbers change their even/odd property

        • 3 weeks ago
          Anonymous

          Where do you work where the people maintaining your code don't understand modulo?

        • 3 weeks ago
          Anonymous

          Any Black person moron who doesn't know what modulo is in the context of programming deserves to get filtered.

        • 3 weeks ago
          Anonymous

          >Someone not familiar with math doesn't know what the frick "%2 == 0" is doing,
          Why would someone unfamiliar with math be working on math code? That is just poor management.

          • 3 weeks ago
            Anonymous

            because of diversity hires

        • 3 weeks ago
          Anonymous

          >This is false though. Someone not familiar with math doesn't know what the frick "%2 == 0" is doing, where the code in the OP is immediately clear to anyone, and it's easier to maintain in the future should certain numbers change their even/odd property, you just change the corresponding line without having to come up with a new algorithm.

        • 3 weeks ago
          Anonymous

          >in the future should certain numbers change their even/odd property
          Lost it, 10/10

        • 3 weeks ago
          Anonymous

          Another way would be to have an EvenOrOddNumber class with a parameter to record the evenness of the number at creation time, you'd use it like
          myNumber = EvenOrOddNumber.New(15, "odd");
          Which is even more readable and can also handle cases where a number is neither "even" or "odd"

        • 3 weeks ago
          Anonymous

          I know this is bait but people who don't know what modulo is shouldn't be let near computers at all
          The internet is a fricking traversty

          • 3 weeks ago
            Anonymous

            >You need to know what shitdulo is if you want to play video games
            moron

            • 3 weeks ago
              Anonymous

              yes

        • 3 weeks ago
          Anonymous

          >easier to maintain in the future should certain numbers change their even/odd property
          moron, that doesn't mean you should hard code the numbers. Put them in a nice database instead so you can query the odd/even state for any number you have added to the database!

  8. 3 weeks ago
    Anonymous

    moron here. What is this?

    • 3 weeks ago
      Anonymous

      some uneducated L-take is what it is

      • 3 weeks ago
        Anonymous

        meds

  9. 3 weeks ago
    Anonymous

    I don't really get why people program like this. My programming experience is extremely limited but I guarantee it would take someone less time to google how to do that more efficiently than it would to manually type all that shit in.
    If you're getting paid by the hour I guess it's a good way to waste time while you listen to a podcast or something but I assume this is yandev's code or some other moron so the only person whose time is being wasted is their own.

    • 3 weeks ago
      Anonymous

      Maybe instead of manually typing it all in they wrote a program to write it all out.
      It's a joke, nobody is actually writing code like that.

  10. 3 weeks ago
    Anonymous

    #import "iseven.h"

    private bool isEven(int number) {
    return isEvenLibrary::isEven(number);
    }

  11. 3 weeks ago
    Anonymous
    • 3 weeks ago
      Anonymous

      I wish I had the patience for it
      But BP visual scripting is so fricking sloooooow
      Gotta brush up on my C++...

  12. 3 weeks ago
    Anonymous

    lines of code =/= number of instructions

  13. 3 weeks ago
    Anonymous
    • 3 weeks ago
      Anonymous

      Wouldn't it be better to store "Teacher Weapon Reaction" as a string?

    • 3 weeks ago
      Anonymous

      He used fricking string????

      • 3 weeks ago
        Anonymous

        public boolean IsEven(int number){
        switch(Integer.toString(number)[0]){
        case '0':
        case '2':
        case '4':
        case '6':
        case '8':
        return true;
        default:
        return false
        }
        }

  14. 3 weeks ago
    Anonymous

    For me, it's programming in spreadsheets, the best design philosophy.

    • 3 weeks ago
      Anonymous

      >Stat sheets
      >Tilemaps
      >Location coordinate charts
      >damage type lookup tables
      >Game progression recording

    • 3 weeks ago
      Anonymous

      What exactly are you implying? Using a spreadsheet for data like this is perfectly fine. Afterwards you can generate whatever kind of code you want from the data.

      • 3 weeks ago
        Anonymous

        I just wanted an excuse to post Diablo 2 spreadsheets. Of course the game runs at 25 FPS because that is what the animations were set up for. God I love spreadsheets.

  15. 3 weeks ago
    Anonymous

    The compiler will optimize it.

  16. 3 weeks ago
    Anonymous

    >Pseuds need to feel intelligent by knocking down a joke post from r/programmerhumor

  17. 3 weeks ago
    Anonymous

    >Not reading csv files into Unity for your scriptable object pipeline

  18. 3 weeks ago
    Anonymous

    Why wouldn't this work?

    • 3 weeks ago
      Anonymous

      Needlessly obtuse and inefficient, but works unless somehow your system is using EBCDIC internally. Can compliant C++ even be non-ASCII non-Unicode? I don't actually know.

    • 3 weeks ago
      Anonymous

      >if statement inside a for loop

      Ask me how I know you're a fricking pajeet.

      • 3 weeks ago
        Anonymous

        > return lastDigit - (2 * i) == "0";

        better?

        • 3 weeks ago
          Anonymous

          Just declare a variable as int then use modulus to return "even" if no remainder when divided by 2 else "odd", no need to overcomplicate everything. It makes it impossible for anyone who comes along after you to figure out what your code is doing.

      • 3 weeks ago
        Anonymous

        Your code is unreadable teenager-chan also stop abusing lambdas.

  19. 3 weeks ago
    Anonymous

    >Makes you game run in 5 fps
    Yeah, but due to unoptimized shaders or some moronic poly-count.
    Yes, this is a bad code. Is it impacting performance in any significant way tho? Maybe it's not a part of some critical performance path and it's just called once?
    With modern CPUs and compilers the actual programmers are rarely at fault.
    In a lot of cases little optimization is needed on CPU side (unless it's a port to Switch or some insanely physics heavy game)

  20. 3 weeks ago
    Anonymous

    just compare the least significant bit to 1 what the frick is this Black personlition

  21. 3 weeks ago
    Anonymous

    This is how I passed a test in my coding class in high school. the problem was making a calculator.

    • 3 weeks ago
      Anonymous

      Sir why did you not watched the tutorial?

  22. 3 weeks ago
    Anonymous

    isEven(num) {

    bool isEven = false

    for(i=0; i<9999999; i+1) {

    if(i%2 == 0) {

    if(if == num) {

    isEven = true

    }

    }

    if(isEven == true) {

    return true

    } else {

    if(isEven == false) {

    return false

    } else {

    throw(Exception e)

    }

    }

    }

    easy

  23. 3 weeks ago
    Anonymous
  24. 3 weeks ago
    Anonymous

    1.Check if the int has one number or more
    2.Check if the first of last number is 2, 4, 6 or 8
    Done, and I never programmed a day in my life, now give me a job

    • 3 weeks ago
      Anonymous

      >2.Check if the first of last number is 2, 4, 6 or 8
      good morning sar, you forgot to do the needful with numbers ending in 0

  25. 3 weeks ago
    Anonymous

    interface IntegerNumberEvaluator
    {
    public bool EvaluateInteger(int integerToEvaluate);
    }

    public class IntegerModulusEvaluatorFactory
    {
    public IntegerEvaluator getIntegerModulusEvaluator(int integerToEvaluateAgainst)
    {
    return new IntegerModulusEvaluator(integerToEvaluateAgainst);
    }
    private class IntegerModulusEvaluator
    {
    int m_integerToEvaluateAgainst;
    public IntegerModulusEvaluator(int integerToEvaluateAgainst)
    {
    m_integerToEvaluateAgainst = integerToEvaluateAgainst;
    }
    public int EvaluateInteger(int integerToEvaluate)
    {
    result = integerToEvaluate % integerToEvaluateAgainst;
    //Return the result
    return result;
    }
    }
    }

    public bool IsEven(number){
    IntegerModulusEvaluatorFactory LocalEvaluatorFactory = new IntegerModulusEvaluatorFactory();//Singletons are considered a harmful anti-pattern
    IntegerNumberEvaluator ModulusTwoEvaluator = LocalEvaluatorFactory.getIntegerModulusEvaluator(2);
    int EvaluationResult = ModulusTwoEvaluator.EvaluateInteger(number);
    int Result = 0;
    switch(EvaluationResult)
    {
    case 0:
    Result = true;
    break;
    case 1:
    Result = false;
    break;
    default:
    Result = false;
    break;
    }
    return Result;
    }

    • 3 weeks ago
      Anonymous

      J2E is mental illness.

      • 3 weeks ago
        Anonymous

        filtered & skill issue

        • 3 weeks ago
          Anonymous

          Having your apache server take 6Go RAM for a Hello World is not normal, anon.

  26. 3 weeks ago
    Anonymous

    That's nothing, some """people""" put branching code in their shaders

    • 3 weeks ago
      Anonymous

      My high school programming skills aren't advanced enough to tell me what this means.

      • 3 weeks ago
        Anonymous

        if statements are extremely bad in shaders, because GPU cores are not equipped to handle branching code like CPU cores are.

        As a quick example, say you wanted to color a pixel red if a condition was met.

        If you write

        if (condition) {
        pixel.red = 255
        } else {
        pixel.red = 0
        }

        It will be very slow. But if you coerce your condition into a boolean int you can do

        pixel.red = 255 * condition

        And it will perform incredibly fast comparatively.

        However, writing branchless code is a completely different beast from usual programming, so there's definitely a learning curve.

  27. 3 weeks ago
    Anonymous

    Upgrade your PC, chud

  28. 3 weeks ago
    Anonymous

    Doing this is actually faster than modulo at runtime and saves cycles if you really wanted to optimize it that hard.

  29. 3 weeks ago
    Anonymous

    return parseInt(inputValue, 2).toString().subString(-1, 1) === 1

  30. 3 weeks ago
    Anonymous

    public bool IsEven(int number){
    switch(number){
    case 0: return true
    default: return !IsEven(number-1);
    }}

    Short, compact and concise. Functional programming is the future.

    • 3 weeks ago
      Anonymous

      What benefits does this switch have over
      if (number === 0) return true
      return !IsEven(number-1);
      ?

    • 3 weeks ago
      Anonymous

      Just because you use recursion, doesn't mean it's functional

      • 3 weeks ago
        Anonymous

        AYOOOO

  31. 3 weeks ago
    Anonymous

    BOOLA

  32. 3 weeks ago
    Anonymous

    Coding is fascinating to me even if it's bad, because I can barely wrap my head around how it even works. How do people make video games and other computer programs out of these seemingly meaningless phrases?

    • 3 weeks ago
      Anonymous

      Behind each meaningless phrase is a lot of other meaningless phrases that eventually translate into the real world "turn this light on" or "turn this light off".
      If you accumulate enough meaningless phrases, eventually you reach the level of modern software.

    • 3 weeks ago
      Anonymous

      I don't see how you can interpret it as meaningless keywords unless your pattern searching monke brain is broken. Most people will look at the OP and figure out what it does because every human has a natural understanding of syntax

      • 3 weeks ago
        Anonymous

        ok, I can understand what it would do on a basic level. It makes something happen depending on if a number is even or not

        • 3 weeks ago
          Anonymous

          are you a lizard man?

          • 3 weeks ago
            Anonymous

            yeah

    • 3 weeks ago
      Anonymous

      Just study the 8086 cpu and assembler for 8086.
      Then a bit of x86 asm and c.
      Everything will be clear as day after a few years of studying.

  33. 3 weeks ago
    Anonymous

    the first thing I see in this image is a troony flag
    I have been successfully mindbroken by this site

    • 3 weeks ago
      Anonymous

      stop getting mindbroken by pol and think for yourself
      (trannies are good because competing males take themselves out of the genepool so you have more women available to you as a result)

      • 3 weeks ago
        Anonymous

        Sauce?

      • 3 weeks ago
        Anonymous

        But I don't like woman and all I want is traps but hotter looking and less cringe.
        ITS NOT FAIR.
        EVEN THEIR PERSONALITIES ARE AIDS, NOT JUST THEIR BODIES.
        AAAAAAAAAA

      • 3 weeks ago
        Anonymous

        >/misc/ out of nowhere

      • 3 weeks ago
        Anonymous

        I hate these pictures because that's an obviously female bangin' bod but the artist insists that's a dude.
        Those are not male hips or legs

        • 3 weeks ago
          Anonymous

          >draw a woman
          >say it's a man
          classic

    • 3 weeks ago
      Anonymous

      >
      >(trannies are good because competing males take themselves out of the genepool so you have more women available to you as a result)
      this doesnt work because women are fine with sharing Chad. They were never a part of competition in the first place

      • 3 weeks ago
        Anonymous

        I didn't mean men dating trannies.

        there are 10 men and 10 women in a room, if 3 men become trannies, then they'll only have 7 men to compete with, which also raises the attractiveness of the men towards the women because there's less selection overall. If now 2 other men decide to frick the trannies, then there's only 5 competitive males left to spread amongst 10 women.

        Only cucks would be against trannies, because as a real man the more trannies exist the easier it gets for you. At some point women will just owe you sex by default.

  34. 3 weeks ago
    Anonymous

    >0%|0%
    >makes your PC stop

  35. 3 weeks ago
    Anonymous

    conditional checking is O(1)

  36. 3 weeks ago
    Anonymous

    isDivisible n x = mod n x == 0
    isEven n = isDivisible n 2

    main = do
    putStrLn "Please enter an integer"
    input <- getLine
    let x = (read input :: Int)
    if isEven x
    then putStrLn "Even"
    else putStrLn "Odd"

  37. 3 weeks ago
    Anonymous

    I thought compilers do micro-optimization well because people say so but after inspecting a few games in assembly and seeing Linus complaining about clang, I'm starting to think it's a fricking myth and BS. (maybe just the incompetent devs didn't put -O but idk)

  38. 3 weeks ago
    Anonymous

    >just use rpgmaker bro it's ea-

  39. 3 weeks ago
    Anonymous

    Huh? It turns into only a few assembly instructions, so what's the problem?

    • 3 weeks ago
      Anonymous

      Somethings not right.

    • 3 weeks ago
      Anonymous

      jeets win again

  40. 3 weeks ago
    Anonymous

    >guys, we'll use MATH to solve these complex number issues!
    >computers are great at math!
    >it's actually faster to just make a list of all the prime numbers we've discovered so far and just have the computer read the entire list and compare than to actually calculate prime numbers
    In other news, circles are round.

    • 3 weeks ago
      Anonymous

      >>it's actually faster to just make a list of all the prime numbers we've discovered so far and just have the computer read the entire list and compare than to actually calculate prime numbers
      Just hash them.

      • 3 weeks ago
        Anonymous

        We don't use "hash" you fricking junkie

        • 3 weeks ago
          Anonymous

          Hashtag NoJunkie

    • 3 weeks ago
      Anonymous

      Uhh actually
      Circles on computer screen are made of square pixels, and therefore they have sharp edges which means they are not round

    • 3 weeks ago
      Anonymous

      This is the single core/no multitasking mentality from the nineties.
      When you have only limited cpu cache size(relatively to RAM of course some MB to GB) but you have 8 cores you can do some parallelization and treat one core or two as just side cores that do such calculations so you dont have too many lists loaded into the cache.

      • 3 weeks ago
        Anonymous

        Counter point to your techo jargon bullshit: You will not need a prime number that is 1,000,000 integers long for any practical reason you autistic moron.

        Use the list.

        • 3 weeks ago
          Anonymous

          Not in this case. But again theres other cases and lovers of lookup tables and such often overlook the reality that some of that shit can be done on a hyperthreadead core or intels E cores that usually just arent used or considered.
          homosexuals like you are the reason why ai in games is still rudimentary.
          >inb4 give some example
          EU4 is a game that has like 200+ "tags" or countries like Civs in Civilization game. Each of these has an army, or two or more, each of them has several things to simulate its tax income, trade, diplomatic relations etc.
          And it was made for a dual core or ideally a quad core with high singe core performance back in 2013.

          Many of its systems are limited because theres 200+ such countries and it works in real time, theres no turns like in civ. So instead of making it more complex and a better abstraction for a grand strategy, they just made it more simple. Instead of complex layers of simulation they made simple mana bars for military research and diplomatic tech and such.
          Because a simple excell sheet is easier on the cpu.

  41. 3 weeks ago
    Anonymous

    why would you need to know if a number is even anyway

  42. 3 weeks ago
    Anonymous

    Wouldn't it be computationally faster to grab the last digit and do 5 comparisons than using modullo?

    • 3 weeks ago
      Anonymous

      Most compilers will optimize "x mod 2" to "x & 1" (i.e. return the last bit of the number), which is incredibly fast.

      • 3 weeks ago
        Anonymous

        Thanks for the explanation. Is there any easily digestible resource for non programmer to learn about quirky compiler optimizations?

  43. 3 weeks ago
    Anonymous

    Man, coding is the most soulless shit imaginable. No wonder so many codemonkeys are troons.

  44. 3 weeks ago
    Anonymous

    Here's my attempt at timer

    int Seconds;
    int Minutes;
    int Hours;

    Seconds += Time.deltaTime;

    if(Seconds == 60)
    {
    Minutes++;
    Seconds = 0;
    }

    if(Minutes == 60)
    {
    Hours++;
    Minutes = 0;
    }

  45. 3 weeks ago
    Anonymous

    >this is the type of shit I need to understand to have a job in the 2024th century

    • 3 weeks ago
      Anonymous

      at least 50% of programmers don't understand basic shit like this

  46. 3 weeks ago
    Anonymous

    Just use ChatGPT

  47. 3 weeks ago
    Anonymous

    Compiler will optimize it away anyway.

  48. 3 weeks ago
    Anonymous

    how would you write

    #include <iostream>

    const bool b_OP_IS_A_homosexual = true;
    int main(){
    do
    (std::cout << "OP IS A homosexual" << std::endl);
    while (b_OP_IS_A_homosexual == true);

    return 0;

    }

    in C#?

    • 3 weeks ago
      Anonymous

      It's important to note that using offensive language is not appropriate, and it's recommended to maintain a respectful and inclusive tone in programming and any other communication. However, I understand that you are looking for a C# equivalent of the provided C++ code. Here's a version of the code without offensive language:

      csharp
      Copy code
      using System;

      class Program
      {
      static bool OpIsAwesome = true;

      static void Main()
      {
      do
      {
      Console.WriteLine("OP is awesome");
      } while (OpIsAwesome);

      Console.ReadLine();
      }
      }
      In this C# version, I've replaced the offensive language with a positive message. The code uses a do-while loop to repeatedly print the message as long as the OpIsAwesome variable is true. The Console.ReadLine(); at the end is added to keep the console window open after the loop exits.

      • 3 weeks ago
        Anonymous

        >without the offensive language
        kek. cucked AI

  49. 3 weeks ago
    Anonymous

    There was a ruskie dude who made a 40 gb assembly program that did this for every 32 bit number. It worked surprisingly well, about 10 seconds for a big number and instanteneous-ish for a small one.

    • 3 weeks ago
      Anonymous

      >ruskie
      They're all morons, it doesn't matter. None of them write good code.

      • 3 weeks ago
        Anonymous

        It was a joke project. It takes some tricks to make 40 gb of code that runs, OS doesn't support that normally.

  50. 3 weeks ago
    Anonymous
  51. 3 weeks ago
    Anonymous
  52. 3 weeks ago
    Anonymous

    function isEven(x){
    return x;
    }

    Done. Not my problem, the other people on the project can just build around this

  53. 3 weeks ago
    Anonymous

    function isEven(int number) {
    return (round(number / 2) * 2 == number);
    }

Your email address will not be published. Required fields are marked *