• unalivejoy@lemm.ee
    link
    fedilink
    English
    arrow-up
    63
    arrow-down
    1
    ·
    9 months ago

    You call that russian roulette? This is real russian roulette. Dying is a 1/6 probability.

    #!/usr/bin/env python3
    import random
    
    barrel = [0, 0, 0, 0, 0, 1]
    random.shuffle(barrel)
    
    print("Russian Roulette")
    for i in barrel:
      input("Press enter to shoot")
      if i == 1:
        print("You are dead.")
        exit()
      else:
        print("Phew. You survived.")
    
  • mox@lemmy.sdf.org
    link
    fedilink
    arrow-up
    30
    ·
    9 months ago

    Perfectly safe on Windows, too. The remove() function doesn’t work on directories.

        • egonallanon@lemm.ee
          link
          fedilink
          arrow-up
          6
          arrow-down
          1
          ·
          9 months ago

          Yeah I’m a big fan of it. People complain about the verbosity of it but I like that for readability and autocomplete makes that a non issue I find. Plus if you really want to save on typing when using it as a terminal tool you can just make aliases for all your common commands.

          • okamiueru@lemmy.world
            link
            fedilink
            arrow-up
            5
            ·
            9 months ago

            No complaints from me. Maybe if I had to use it. The thing that strikes me as particularly noisy is what seems to be either case insensitive commands and flags, or case sensitive and using Pascal-Case for both commands and flags. Which would be my least preferred option.

        • OfficerBribe@lemm.ee
          link
          fedilink
          arrow-up
          2
          ·
          9 months ago

          I work pretty frequently with PS and have no issues with syntax. It’s easy to read and you always have autocomplete so there is just 1 extra click to get from -r to -Recurse. Same command could be also written as this due to alias feature.

          rm 'C:' -r -fo

          It’s just not the best practice since in PowerShell it is recommended to not use aliases for readability reasons. Also less chance to mess things up due to how verbose all commands and their parameters are.

            • OfficerBribe@lemm.ee
              link
              fedilink
              arrow-up
              1
              ·
              9 months ago

              It is. Besides some very niche bugs everything in the core of PowerShell seems logical to me and easy to understand.

    • Matriks404@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      9 months ago

      And Windows nowadays have like dozen of different security measures that stop you from removing critical system components. It is not like in Windows 95 days, that OS allowed you to remove kernel by just typing a single command.

  • philomory@lemm.ee
    link
    fedilink
    English
    arrow-up
    25
    ·
    9 months ago

    Wow, a Lain meme was not something I was expecting.

    I should watch that show again sometime, I still have the DVDs somewhere I think.

  • GluWu@lemm.ee
    link
    fedilink
    arrow-up
    20
    ·
    9 months ago

    Fuck off, I know what I’m doing.

    Omg someone please help how did I get this far they’re going to realize I’m stupid when they fire me everything will collapse because it’s all in a single excel file I need to figure out how to live in a tent in the woods and hunt and forage

  • Redkey@programming.dev
    link
    fedilink
    arrow-up
    6
    ·
    9 months ago

    Oh hell, you gave me a PTSD flashback!

    It’s the late 90s. My mother suddenly discovers File Explorer on her refurbished commodity Wintel box and decides that all this messy clutter has to go. Never mind that the drive was 80% empty when delivered and I didn’t expect her to come close to filling it before it was replaced. Fortunately I had already backed up everything that looked important or interesting.

    One day she calls from the office, “I don’t need this ‘Windows’ any more, do I?”

    “What? Wait! Don’t do anything!” I walk in and she’s got C:/Windows highlighted and the cursor is hovering over “Delete”.

    “I already have Windows installed on this computer, so I don’t need this any more, do I?” Spoken more as a statement than a question. It took several minutes of forced calm explanation to get her to accept that this “Windows” directory WAS the Windows that’s installed on the machine. She still wasn’t happy that she could see it in File Explorer, though. So untidy!

  • random9@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    9 months ago

    isn’t randint range inclusive? thus random.randint(0, 6) == 1 has a 1 in 7 chance, not 1 in 6. Most revolvers, assuming this is emulating russian roulette, have 6 cylinders, not 7.

    • nifty@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      9 months ago

      You’re right. I didn’t make this, but maybe the creator was accounting for the round in the chamber? I don’t guns, so no clue.

      • random9@lemmy.world
        link
        fedilink
        arrow-up
        4
        ·
        9 months ago

        Revolvers don’t have the concept of one-in-the-chamber, only semi-auto pistols do, and you can’t play russian roulette with semi-autos :P (well you could, but 99% of the time, barring unexpected jams, the first person to go would lose)

        Anyway I’m guessing it’s a bug :) - as the saying goes “no code is too short to be bug-free”

        • nifty@lemmy.worldOP
          link
          fedilink
          arrow-up
          2
          ·
          9 months ago

          Good to know! Makes it easier to decide what to get next time I play Russian roulette.