Skip to main content
4 of 5
deleted 176 characters in body
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

05AB1E, 77 74 bytes

0V‘‚µ‘©IÇv¼®¾4%3÷׫Yy₁+b¦RCDV-₁%¾‘DO,1—¨#ÿ<-#ÿ‘«}¾‘DO,1<-#ÿÿ€·‚Ø€Ä,1€·†¿€¾

Port of @Lynn's Python answer, so make sure to upvote him/her as well!

Outputs with spaces at 1 SUB and DO READ OUT,1 DO GIVE UP.

Try it online or verify a few more test cases.

Try the output in INTERCAL.

Explanation:

0V                 # Set variable `Y` to 0 (it's 2 by default)
‘‚µ‘               # Push dictionary string "PLEASE"
    ©              # Store it in variable `®` (without popping)
IÇ                 # Push the input, and convert it to a list of codepoint integers
  v                # Loop over each integer `y`:
   ¼               #  Increment the counter_variable (0 by default)
    ¾              #  Push the counter_variable
     4%            #  Modulo-4
       3÷          #  Integer-divided by 3
   ®     ×         #  Repeat "PLEASE" from variable `®` that many times
          «        #  Append it to the string
   Y               #  Push the current `Y`
    y              #  Push the current codepoint
     ₁+            #  Increase it by 256
       b           #  Convert it to a binary string
        ¦          #  Remove the leading 1 (the `₁+` and `¦` are to pad leading 0s)
         R         #  Reverse it
          C        #  Convert it from binary to a base-10 integer
           DV      #  Store a copy as new value for variable `Y`
           -       #  Subtract it from the `Y` we've pushed earlier
            ₁%     #  Modulo-256
   ¾               #  Push the counter_variable
    ‘DO,1—¨#ÿ<-#ÿ‘ #  Push dictionary string "DO,1 SUB#ÿ<-#ÿ", where the `ÿ` are 
                   #  automatically filled with the counter_variable and `Y`%256
      «            #  Append it to the string as well
}¾                 # After the loop: push the counter_variable
  ‘DO,1<-#ÿÿ€·‚Ø€Ä,1€·†¿€¾
                   # Push dictionary string "DO,1<-#ÿÿ DO READ OUT,1 DO GIVE UP", where
                   # the `ÿ` are automatically filled with the counter_variable and
                   # string
                   # (after which the result is output implicitly)

See this 05AB1E tip of mine (section How to use the dictionary?) to understand why ‘‚µ‘ is "PLEASE"; ‘DO,1—¨#ÿ<-#ÿ‘ is "DO,1 SUB#ÿ<-#ÿ"; and ‘DO,1<-#ÿÿ€·‚Ø€Ä,1€·†¿€¾ is "DO,1<-#ÿÿ DO READ OUT,1 DO GIVE UP".

Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384