Skip to main content
deleted 987 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

05AB1E, 77 74 74 54 bytes

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

Port of-20 bytes by porting @Lynn's Python answer@UnrelatedString's Jelly answer, so make sure to upvote him/her as well!!

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

Try it onlineTry it online or verify a few more test casesverify a few more test cases.

Try the output in INTERCAL.Try the output in INTERCAL.

0V                 # Set variable `Y` to 0 (it's 2 by default)
‘‚µ‘               # Push dictionary string "PLEASE"
   Ç ©              # Store it in variableConvert `®`the (without poppingimplicit) # Push the input, and convert it-string 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
    ₁+      «        #  AppendAdd it256 to theeach stringvalue
   Y    ₁š           #  Push the current `Y`
    y              #Prepend 256 Pushat the current codepoint
     ₁+            #  Increasefront itof bythe 256list
       b           #  Convert iteach value to a binary string
        ¦ í         #  Remove the leading 1 (the `₁+` and `¦` are to pad leadingReverse 0s)each
        ۬ R      # Remove the #last digit Reverseof iteach
          C        #  Convert iteach from binary back to a base-10 integer
           DV ¥     #  Store aTake copythe asforward newdifferences value(deltas) forof variablethis `Y`list
           -   (    #  Subtract it from the `Y` we'veNegate pushedeach earlierdifference
            ₁%     # Take Modulomodulo-256
  on ¾each
€               # Map Pushover theeach counter_variableinteger:
    ‘DO‘‚µ,1—¨#ÿ<1<-#ÿ‘ #  Push dictionary string "DO#1€·,1 SUB#ÿ<1—¨#1<-#ÿ"#ÿ€·‚Ø€Ä, where the `ÿ` are 1‘
                   #  automaticallyPush filleddictionary withstring the"PLEASE,1<-#1 counter_variableDO,1 andSUB#1<-#ÿ `Y`%256
DO READ OUT",
    «            #  Append it towhere the string`ÿ` asis well
}¾automatically filled with the integer
   J          # After the# loop:Join pushthis thelist counter_variable
of strings ‘DO,1<-#ÿÿ€·‚Ø€Ä,1€·†¿€¾together
               ‘ÿ€·†¿€¾    # Push dictionary string "DO,1<-#ÿÿ DO READ OUT,1"ÿ DO GIVE UP", where
                   # the `ÿ` are`y` automaticallyis 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—¨#ÿ<1<-#ÿ‘#1€·,1—¨#1<-#ÿ€·‚Ø€Ä,1‘ is "DO"PLEASE,1<-#1 DO,1 SUB#ÿ<SUB#1<-#ÿ"#ÿ DO READ OUT"; and ‘DO,1<-#ÿÿ€·‚Ø€Ä,1€·†¿€¾‘ÿ€·†¿€¾ is "DO,1<-#ÿÿ DO READ OUT,1"ÿ DO GIVE UP".

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.

0V                 # Set variable `Y` to 0 (it's 2 by default)
‘‚µ‘               # Push dictionary string "PLEASE"
    ©              # Store it in variable `®` (without popping) # 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".

05AB1E, 77 74 54 bytes

Ç₁+₁šb퀨C¥(₁%€‘‚µ,1<-#1€·,1—¨#1<-#ÿ€·‚Ø€Ä,1‘J‘ÿ€·†¿€¾

-20 bytes by porting @UnrelatedString's Jelly answer, so make sure to upvote him!!

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

Try it online or verify a few more test cases.

Try the output in INTERCAL.

Ç               # Convert the (implicit) input-string to a list of codepoint integers
 ₁+             # Add 256 to each value
   ₁š           # Prepend 256 at the front of the list
     b          # Convert each value to a binary string
      í         # Reverse each
       ۬       # Remove the last digit of each
         C      # Convert each from binary back to a base-10 integer
          ¥     # Take the forward differences (deltas) of this list
           (    # Negate each difference
            ₁%  # Take modulo-256 on each
€               # Map over each integer:
 ‘‚µ,1<-#1€·,1—¨#1<-#ÿ€·‚Ø€Ä,1‘
                #  Push dictionary string "PLEASE,1<-#1 DO,1 SUB#1<-#ÿ DO READ OUT",
                #  where the `ÿ` is automatically filled with the integer
   J            # Join this list of strings together
    ‘ÿ€·†¿€¾    # Push string "ÿ DO GIVE UP", where the `y` is filled with the string
                # (after which the result is output implicitly)

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

deleted 176 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

05AB1E, 77 77 74 bytes

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

Try it onlineTry it online or verify a few more test casesverify a few more test cases.

00V                 # PushSet variable `Y` to 0 (head-integerit'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)
   s ¾            #  Swap# so thePush head-integerthe iscounter_variable
 at the top of the4% stack
    D       #  Modulo-4
   #  Duplicate it
     y      #  Integer-divided by 3
 #  Push® the current codepoint
  ×    ₁+     #  Repeat "PLEASE" #from variable Increase`®` itthat bymany 256times
        b  «        #  ConvertAppend it to a binarythe string
   Y      ¦       #  Remove the# leading 1Push (the `₁+` and `¦`current are`Y`
 to pad leading 0s)
y          R    #  #Push the Reversecurrent itcodepoint
     ₁+      C      #  ConvertIncrease it from binary toby a256
 base-10 integer
     b       -    #  SubtractConvert it from the duplicated head-integer
             DV  #  Storeto a copy in variablebinary `Y`string
        ¦       - #  Subtract# it fromRemove the head-integer
   s           leading 1 #(the `₁+` Swapand so`¦` theare stringto ispad atleading the0s)
 top again
     ¾  R         #  Push theReverse counter_variableit
      4%      C   #  Modulo-4
    #  Convert it from binary to a base-10 integer
  #  Integer-divided by 3
    ® DV    ×  #  Store a #copy as Repeatnew "PLEASE"value fromfor variable `®` that`Y`
 many times
         -  «     #  AppendSubtract it tofrom the string
    Y       `Y` we've pushed earlier
  #  Push integer `Y` again
     ₁%          #  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)

05AB1E, 77 bytes

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

Try it online or verify a few more test cases.

0                # Push 0 (head-integer)
‘‚µ‘             # 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)
   s             #  Swap so the head-integer is at the top of the stack
    D            #  Duplicate it
     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
            -    #  Subtract it from the duplicated head-integer
             DV  #  Store a copy in variable `Y`
               - #  Subtract it from the head-integer
   s             #  Swap so the string is at the top again
     ¾           #  Push the counter_variable
      4%         #  Modulo-4
               #  Integer-divided by 3
    ®     ×      #  Repeat "PLEASE" from variable `®` that many times
           «     #  Append it to the string
    Y            #  Push integer `Y` again
     ₁%          #  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)

05AB1E, 77 74 bytes

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

Try it online or verify a few more test cases.

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
                 #  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)
Fixed typo in the dictionary string
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

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

0                # Push 0 (head-integer)
‘‚µ‘             # 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)
   s             #  Swap so the head-integer is at the top of the stack
    D            #  Duplicate it
     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
            -    #  Subtract it from the duplicated head-integer
             DV  #  Store a copy in variable `Y`
               - #  Subtract it from the head-integer
   s             #  Swap so the string is at the top again
     ¾           #  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 integer `Y` again
     ₁%          #  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".

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

0                # Push 0 (head-integer)
‘‚µ‘             # 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)
   s             #  Swap so the head-integer is at the top of the stack
    D            #  Duplicate it
     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
            -    #  Subtract it from the duplicated head-integer
             DV  #  Store a copy in variable `Y`
               - #  Subtract it from the head-integer
   s             #  Swap so the string is at the top again
     ¾           #  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 integer `Y` again
     ₁%          #  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".

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

0                # Push 0 (head-integer)
‘‚µ‘             # 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)
   s             #  Swap so the head-integer is at the top of the stack
    D            #  Duplicate it
     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
            -    #  Subtract it from the duplicated head-integer
             DV  #  Store a copy in variable `Y`
               - #  Subtract it from the head-integer
   s             #  Swap so the string is at the top again
     ¾           #  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 integer `Y` again
     ₁%          #  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".

added 2347 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading