Skip to main content
Commonmark migration
Source Link

#05AB1E, 42 bytes

05AB1E, 42 bytes

ð¶:S3úJ46ú[D50£¶ð:D?IQ#ðõ.;“…¢('\r')“.eт.W

Try it online (without the sleep). NOTE: I don't have 05AB1E installed locally, so I'm not 100% sure if the \r trick works (in theory it should work, however). In TIO the \r are interpret as newlines instead. Also, the TIO uses the legacy version, because .e is disabled in the new TIO version (program is the same in both the legacy and new version of 05AB1E, though).

Explanation:

ð¶:            # Replace all spaces in the (implicit) input-string with newlines
   S           # Split the string to a list of characters
    3ú         # Pad each character with 3 leading spaces
      J        # Join the characters together again
       46ú     # And pad the entire string with an additional 46 leading spaces
[              # Now start an infinite loop:
 D             #  Duplicate the string
  50£          #  And leave only the first 50 characters of this copy as substring
     ¶ð:       #  Replace the newlines back to spaces
        D?     #  Duplicate the string, and print it without trailing newline
 IQ            #  If the current string is equal to the input:
   #           #   Stop the infinite loop
 ðõ.;          #  Replace the first space with an empty string to remove it
 “…¢('\r')“    #  Push dictionary string "print('\r')"
           .e  #  Evaluate it as Python code
 т.W           #  Sleep for 100 ms

See this 05AB1E tip of mine (section How to use the dictionary?) to understand why “…¢('\r')“ is "print('\r')".

#05AB1E, 42 bytes

ð¶:S3úJ46ú[D50£¶ð:D?IQ#ðõ.;“…¢('\r')“.eт.W

Try it online (without the sleep). NOTE: I don't have 05AB1E installed locally, so I'm not 100% sure if the \r trick works (in theory it should work, however). In TIO the \r are interpret as newlines instead. Also, the TIO uses the legacy version, because .e is disabled in the new TIO version (program is the same in both the legacy and new version of 05AB1E, though).

Explanation:

ð¶:            # Replace all spaces in the (implicit) input-string with newlines
   S           # Split the string to a list of characters
    3ú         # Pad each character with 3 leading spaces
      J        # Join the characters together again
       46ú     # And pad the entire string with an additional 46 leading spaces
[              # Now start an infinite loop:
 D             #  Duplicate the string
  50£          #  And leave only the first 50 characters of this copy as substring
     ¶ð:       #  Replace the newlines back to spaces
        D?     #  Duplicate the string, and print it without trailing newline
 IQ            #  If the current string is equal to the input:
   #           #   Stop the infinite loop
 ðõ.;          #  Replace the first space with an empty string to remove it
 “…¢('\r')“    #  Push dictionary string "print('\r')"
           .e  #  Evaluate it as Python code
 т.W           #  Sleep for 100 ms

See this 05AB1E tip of mine (section How to use the dictionary?) to understand why “…¢('\r')“ is "print('\r')".

05AB1E, 42 bytes

ð¶:S3úJ46ú[D50£¶ð:D?IQ#ðõ.;“…¢('\r')“.eт.W

Try it online (without the sleep). NOTE: I don't have 05AB1E installed locally, so I'm not 100% sure if the \r trick works (in theory it should work, however). In TIO the \r are interpret as newlines instead. Also, the TIO uses the legacy version, because .e is disabled in the new TIO version (program is the same in both the legacy and new version of 05AB1E, though).

Explanation:

ð¶:            # Replace all spaces in the (implicit) input-string with newlines
   S           # Split the string to a list of characters
    3ú         # Pad each character with 3 leading spaces
      J        # Join the characters together again
       46ú     # And pad the entire string with an additional 46 leading spaces
[              # Now start an infinite loop:
 D             #  Duplicate the string
  50£          #  And leave only the first 50 characters of this copy as substring
     ¶ð:       #  Replace the newlines back to spaces
        D?     #  Duplicate the string, and print it without trailing newline
 IQ            #  If the current string is equal to the input:
   #           #   Stop the infinite loop
 ðõ.;          #  Replace the first space with an empty string to remove it
 “…¢('\r')“    #  Push dictionary string "print('\r')"
           .e  #  Evaluate it as Python code
 т.W           #  Sleep for 100 ms

See this 05AB1E tip of mine (section How to use the dictionary?) to understand why “…¢('\r')“ is "print('\r')".

Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#05AB1E, 42 bytes

ð¶:S3úJ46ú[D50£¶ð:D?IQ#ðõ.;“…¢('\r')“.eт.W

Try it online (without the sleep). NOTE: I don't have 05AB1E installed locally, so I'm not 100% sure if the \r trick works (in theory it should work, however). In TIO the \r are interpret as newlines instead. Also, the TIO uses the legacy version, because .e is disabled in the new TIO version (program is the same in both the legacy and new version of 05AB1E, though).

Explanation:

ð¶:            # Replace all spaces in the (implicit) input-string with newlines
   S           # Split the string to a list of characters
    3ú         # Pad each character with 3 leading spaces
      J        # Join the characters together again
       46ú     # And pad the entire string with an additional 46 leading spaces
[              # Now start an infinite loop:
 D             #  Duplicate the string
  50£          #  And leave only the first 50 characters of this copy as substring
     ¶ð:       #  Replace the newlines back to spaces
        D?     #  Duplicate the string, and print it without trailing newline
 IQ            #  If the current string is equal to the input:
   #           #   Stop the infinite loop
 ðõ.;          #  Replace the first space with an empty string to remove it
 “…¢('\r')“    #  Push dictionary string "print('\r')"
           .e  #  Evaluate it as Python code
 т.W           #  Sleep for 100 ms

See this 05AB1E tip of mine (section How to use the dictionary?) to understand why “…¢('\r')“ is "print('\r')".