• idunnololz@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 day ago

      The output isn’t guaranteed to be correct though. Most implementations of sleep can only guarantee that it will sleep for at least the amount of time specified. It can sleep for longer though.

      • JackbyDev@programming.dev
        link
        fedilink
        English
        arrow-up
        4
        ·
        1 day ago

        I remember seeing discussions about this at the time, it would also sometimes fail with a very large number of 1s and a single 2.

    • wise_pancake@lemmy.ca
      link
      fedilink
      arrow-up
      40
      arrow-down
      1
      ·
      3 days ago

      I have a great performance optimization for this

      What if instead of 1s sleep, we did 0.5s sleep? That’s a 100% improvement.

        • JackbyDev@programming.dev
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 day ago

          I took it as meaning sleep for a number of seconds equal to half the value you’re sorting. So like f "(( $1 / 2 ))" & or however math works in bash, I always forget.

              • Amanduh@lemm.ee
                link
                fedilink
                arrow-up
                1
                ·
                20 hours ago

                I bet you also tell people you love regex because you think it makes you look smarter lol

                • JackbyDev@programming.dev
                  link
                  fedilink
                  English
                  arrow-up
                  1
                  ·
                  15 hours ago

                  Well, maybe not with regex, but I’d be lying if I said I never get satisfaction things like that lol. Bash and regex both are very useful tools, great at what they do, but have some design choices that make them annoying. That’s sort of what I was trying to get at by saying “yes but also skill issue” lol. A good example is iterating over output in bash. I have zero confidence it’s going to do anything remotely close to what I want and have to look up stuff every time I’m trying to do it. “Is it going to go word by word? Line by line? Are there null byte separators?” PowerShell seems appealing in that regard because it works with objects instead of text, but I haven’t really used it in depth and I don’t see myself going through it just to see if it’s worth trying to use more often.

        • lurch (he/him)@sh.itjust.works
          link
          fedilink
          arrow-up
          0
          ·
          3 days ago

          the idea isn’t wrong tho, as sleep can do fractions. bash cannot though. therefore it would bloat the code a bit to use bc to multiply the parameter by 0.5 or so.

    • devfuuu@lemmy.world
      link
      fedilink
      arrow-up
      10
      ·
      3 days ago

      For anyone who controls time travel this is the fastest algorithm ever. Probably gonna change everything when we are traveling through space and passing by some dark holes.

    • morrowind@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      2 days ago

      Even as a joke, this doesn’t avoid anything. The system scheduler just has to do the sorting using a regular algorithm

    • rovingnothing29@lemmy.world
      link
      fedilink
      arrow-up
      11
      arrow-down
      1
      ·
      3 days ago

      “Automate the boring stuff with python” to start. As an added bonus you’ll have more downtime as you go.

    • slazer2au@lemmy.world
      link
      fedilink
      English
      arrow-up
      7
      arrow-down
      1
      ·
      3 days ago

      Start by using an existing engine like renpy to get flow and math. Then expand to other engines.

    • Human@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      5
      ·
      3 days ago

      I would start (if you havent already) with an introduction to CS. You can take CS50 for free online - https://cs50.harvard.edu/x/2025/.

      I dont think they cover much C# (I took the 2020 course and they didnt) but they do introduce you to C, C++, Python, html, etc. They provide github codespaces available for anyone for free, so you can complete the weekly labs and problem sets offered in the course. It really is a good jumping off point.

    • kittenzrulz123@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      6
      arrow-down
      2
      ·
      edit-2
      3 days ago

      Learn rust for game dev, develop the game in rust, and then brag about how your game is written 100% in rust (nerds will be extremely impressed, for maximum clout release it under GPL V3 with native Linux support).

    • RandomVideos@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      3 days ago

      Code looks more terrifying than it actually is

      After learning the basics of a programming language, you could try using a game engine like Unity or Godot to not have to code a lot of more complicated things like displaying things and collisions

    • rmuk@feddit.uk
      link
      fedilink
      English
      arrow-up
      3
      ·
      3 days ago

      Be sure to regularly defrag your C: drive or things might slow down.

    • partial_accumen@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      3 days ago

      I know a bit of python and ruby, but doing something similar except I’m writing it in BASIC on a Commodore 64 and am going to attempt to refactor it assembly. I have most of the BASIC version working now.

    • peoplebeproblems@midwest.social
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      1
      ·
      3 days ago

      Find a different career choice!

      Software development is all stress all the time and I don’t know what the fuck I’m doing and I really don’t think this much stress at 34 is healthy even with the salary