• Zagorath@aussie.zone
      link
      fedilink
      English
      arrow-up
      17
      ·
      7 months ago

      Let’s say it takes half a second to copy/paste and submit the message. That’s 50 seconds saved, round it to one minute. You’re only doing it once, so let’s cross over to yearly. According to the Munroe Automation Scale, you can spend up to 5 minutes on it.

      I’d say that code took about 1 minute to write. Maybe 2.

      Result: do the automation.

      • bisby@lemmy.world
        link
        fedilink
        English
        arrow-up
        8
        arrow-down
        1
        ·
        7 months ago

        Caveat: This is all written assuming the message is being written on a computer with a real keyboard. But if we’re assuming this is written on a phone, then my analysis doesn’t apply, but then again, writing a java program to execute in your messaging app is also a terrible idea. Which means we’re suspending disbelief, so I choose to believe that a computer keyboard and shortcuts are available.

        Type the phrase once. Select all. copy, paste, paste (the first paste replaces what you already have highlighted, the second paste adds a second copy). Now you have 2. Control + A, Control + C, Control + V… Now you have 4.

        It will take you only 7 cycles of this get 128*, you only need to copy/paste it one by one if you want to send each message separately. and even then, it’s would purely be copy the original, then paste, send, paste, send, paste send, paste, send.

        Assuming you can hold down control and just hit ACVV 7 times, that’s 28 keystrokes. I’d bet I can get that done in 5 seconds or less (i tried it, it’s less than that), so now I only save 5 seconds. Which means I only get 25 seconds to write the script. Which he chose to write in java for some reason?

        [print("I'm sorry") for x in range(0, 100)] is actually a script I could write in less than 25 seconds.

        *And I disagree with the “reason 4” given. She didn’t say “exactly 100 times” she said “100 times before I forgive you” and to me, “before” implies >= and not ==. So if you drop it in 128 times, that exceeds the criteria. No one has ever rescinded forgiveness for receiving extra apologies.

  • Python@programming.dev
    link
    fedilink
    arrow-up
    12
    arrow-down
    3
    ·
    7 months ago

    I’ll do you one better

    function* sorry() { yield "I'm sorry"; }

    Call sorry.next().value as many times as you need to baby, hell you can even use it in a for-of loop because Generator functions are Iterable. I fucking love JavaScript

    • brian@programming.dev
      link
      fedilink
      arrow-up
      5
      ·
      7 months ago

      lol that doesn’t work either tho. it yields the string once and then is done. you still need a loop inside

      • Python@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        7 months ago

        You’re right! That’s actually a really cool point about Generator functions too, them having while(true) loops is very unproblematic :D

        I’m correcting myself to:

        function* sorry() { while(true){ yield "I'm sorry"; } }