Skip to main content
Rollback to Revision 2
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

05AB1E (legacy), 30 29 bytes

'-×'/.ø©Ð„|.‡I.D®W'.:ÐW‡IoÐW‡In.D»

Uses the legacy version of 05AB1E because it can take the minimum character of a string (based on its unicode value), saving 2 bytes over repushing the characters.

Try it onlineTry it online or verify all test casesverify all test cases.

Explanation:

'-×      '# Repeat "-" the (implicit) input amount of times as string
   '/.ø  '# Surround it with leading/trailing "/"
       ©  # Store this string in variable `®` (without popping)
Ð         # Triplicate it
 „|.‡     # Transliterate the "/" to "|" and "-" to "." in the other copy (the
          # transliterate ignores the trailing "…---/" since the strings are
          # of unequal length)
     I.D  # Duplicate it the input amount of times
®         # Push string `®`
 W        # Push the minimum (without popping): "-"
  '.:    '# Replace all "-" with "." in string `®`
Ð         # Triplicate it
 W        # Push the minimum (without popping): "."
  ‡       # Replace all "/" with "." (transliterate again ignores the trailing
          # "…---/")
   IoIn     # Push 2**inputthe input, and square it
     .D   # Duplicate this string of "."s that many times
»         # Join all strings on the stack by newlines
          # (after which the result is output implicitly)

05AB1E (legacy), 30 29 bytes

'-×'/.ø©Ð„|.‡I.D®W'.:ÐW‡Io.D»

Uses the legacy version of 05AB1E because it can take the minimum character of a string (based on its unicode value), saving 2 bytes over repushing the characters.

Try it online or verify all test cases.

Explanation:

'-×      '# Repeat "-" the (implicit) input amount of times as string
   '/.ø  '# Surround it with leading/trailing "/"
       ©  # Store this string in variable `®` (without popping)
Ð         # Triplicate it
 „|.‡     # Transliterate the "/" to "|" and "-" to "." in the other copy (the
          # transliterate ignores the trailing "…---/" since the strings are
          # of unequal length)
     I.D  # Duplicate it the input amount of times
®         # Push string `®`
 W        # Push the minimum (without popping): "-"
  '.:    '# Replace all "-" with "." in string `®`
Ð         # Triplicate it
 W        # Push the minimum (without popping): "."
  ‡       # Replace all "/" with "." (transliterate again ignores the trailing
          # "…---/")
   Io     # Push 2**input
     .D   # Duplicate this string of "."s that many times
»         # Join all strings on the stack by newlines
          # (after which the result is output implicitly)

05AB1E (legacy), 30 29 bytes

'-×'/.ø©Ð„|.‡I.D®W'.:ÐW‡In.D»

Uses the legacy version of 05AB1E because it can take the minimum character of a string (based on its unicode value), saving 2 bytes over repushing the characters.

Try it online or verify all test cases.

Explanation:

'-×      '# Repeat "-" the (implicit) input amount of times as string
   '/.ø  '# Surround it with leading/trailing "/"
       ©  # Store this string in variable `®` (without popping)
Ð         # Triplicate it
 „|.‡     # Transliterate the "/" to "|" and "-" to "." in the other copy (the
          # transliterate ignores the trailing "…---/" since the strings are
          # of unequal length)
     I.D  # Duplicate it the input amount of times
®         # Push string `®`
 W        # Push the minimum (without popping): "-"
  '.:    '# Replace all "-" with "." in string `®`
Ð         # Triplicate it
 W        # Push the minimum (without popping): "."
  ‡       # Replace all "/" with "." (transliterate again ignores the trailing
          # "…---/")
   In     # Push the input, and square it
     .D   # Duplicate this string of "."s that many times
»         # Join all strings on the stack by newlines
          # (after which the result is output implicitly)
Replaced n**2 with 2**n since I misread the challenge
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

05AB1E (legacy), 30 29 bytes

'-×'/.ø©Ð„|.‡I.D®W'.:ÐW‡InÐW‡Io.D»

Uses the legacy version of 05AB1E because it can take the minimum character of a string (based on its unicode value), saving 2 bytes over repushing the characters.

Try it onlineTry it online or verify all test casesverify all test cases.

Explanation:

'-×      '# Repeat "-" the (implicit) input amount of times as string
   '/.ø  '# Surround it with leading/trailing "/"
       ©  # Store this string in variable `®` (without popping)
Ð         # Triplicate it
 „|.‡     # Transliterate the "/" to "|" and "-" to "." in the other copy (the
          # transliterate ignores the trailing "…---/" since the strings are
          # of unequal length)
     I.D  # Duplicate it the input amount of times
®         # Push string `®`
 W        # Push the minimum (without popping): "-"
  '.:    '# Replace all "-" with "." in string `®`
Ð         # Triplicate it
 W        # Push the minimum (without popping): "."
  ‡       # Replace all "/" with "." (transliterate again ignores the trailing
          # "…---/")
   InIo     # Push the input, and square it2**input
     .D   # Duplicate this string of "."s that many times
»         # Join all strings on the stack by newlines
          # (after which the result is output implicitly)

05AB1E (legacy), 30 29 bytes

'-×'/.ø©Ð„|.‡I.D®W'.:ÐW‡In.D»

Uses the legacy version of 05AB1E because it can take the minimum character of a string (based on its unicode value), saving 2 bytes over repushing the characters.

Try it online or verify all test cases.

Explanation:

'-×      '# Repeat "-" the (implicit) input amount of times as string
   '/.ø  '# Surround it with leading/trailing "/"
       ©  # Store this string in variable `®` (without popping)
Ð         # Triplicate it
 „|.‡     # Transliterate the "/" to "|" and "-" to "." in the other copy (the
          # transliterate ignores the trailing "…---/" since the strings are
          # of unequal length)
     I.D  # Duplicate it the input amount of times
®         # Push string `®`
 W        # Push the minimum (without popping): "-"
  '.:    '# Replace all "-" with "." in string `®`
Ð         # Triplicate it
 W        # Push the minimum (without popping): "."
  ‡       # Replace all "/" with "." (transliterate again ignores the trailing
          # "…---/")
   In     # Push the input, and square it
     .D   # Duplicate this string of "."s that many times
»         # Join all strings on the stack by newlines
          # (after which the result is output implicitly)

05AB1E (legacy), 30 29 bytes

'-×'/.ø©Ð„|.‡I.D®W'.:ÐW‡Io.D»

Uses the legacy version of 05AB1E because it can take the minimum character of a string (based on its unicode value), saving 2 bytes over repushing the characters.

Try it online or verify all test cases.

Explanation:

'-×      '# Repeat "-" the (implicit) input amount of times as string
   '/.ø  '# Surround it with leading/trailing "/"
       ©  # Store this string in variable `®` (without popping)
Ð         # Triplicate it
 „|.‡     # Transliterate the "/" to "|" and "-" to "." in the other copy (the
          # transliterate ignores the trailing "…---/" since the strings are
          # of unequal length)
     I.D  # Duplicate it the input amount of times
®         # Push string `®`
 W        # Push the minimum (without popping): "-"
  '.:    '# Replace all "-" with "." in string `®`
Ð         # Triplicate it
 W        # Push the minimum (without popping): "."
  ‡       # Replace all "/" with "." (transliterate again ignores the trailing
          # "…---/")
   Io     # Push 2**input
     .D   # Duplicate this string of "."s that many times
»         # Join all strings on the stack by newlines
          # (after which the result is output implicitly)
added 25 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

05AB1E (legacy), 3030 29 bytes

'-×'/.ø©ÐÙ„|ø©Ð„|.‡I.D®W'.:ÐW‡In.D»

Uses the legacy version of 05AB1E because it can take the minimum character of a string (based on its unicode value), saving 2 bytes over repushing the characters.

Try it onlineTry it online or verify all test casesverify all test cases.

Explanation:

'-×       '# Repeat "-" the (implicit) input amount of times as string
   '/.ø   '# Surround it with leading/trailing "/"
       ©   # Store this string in variable `®` (without popping)
Ð          # Triplicate it
 Ù         # Uniquify the top copy to "/-"
  „|.‡     # Transliterate the "/" to "|" and "-" to "." in the other copy (the
          # transliterate ignores the trailing "…---/" since the strings are
          # of unequal length)
     I.D  # Duplicate it the input amount of times
®          # Push string `®`
 W         # Push the minimum (without popping): "-"
  '.:     '# Replace all "-" with "." in string `®`
Ð          # Triplicate it
 W         # Push the minimum (without popping): "."
  ‡        # Replace all "/" with "." (the transliterate again ignores the trailing "."
           # in ""…---/." since the strings are of unequal length)
   In      # Push the input, and square it
     .D    # Duplicate this string of "."s that many times
»          # Join all strings on the stack by newlines
           # (after which the result is output implicitly)

05AB1E (legacy), 30 bytes

'-×'/.ø©ÐÙ„|.‡I.D®W'.:ÐW‡In.D»

Uses the legacy version of 05AB1E because it can take the minimum character of a string (based on its unicode value), saving 2 bytes over repushing the characters.

Try it online or verify all test cases.

Explanation:

'-×       '# Repeat "-" the (implicit) input amount of times as string
   '/.ø   '# Surround it with leading/trailing "/"
       ©   # Store this string in variable `®` (without popping)
Ð          # Triplicate it
 Ù         # Uniquify the top copy to "/-"
  „|.‡     # Transliterate the "/" to "|" and "-" to "." in the other copy
      I.D  # Duplicate it the input amount of times
®          # Push string `®`
 W         # Push the minimum (without popping): "-"
  '.:     '# Replace all "-" with "." in string `®`
Ð          # Triplicate it
 W         # Push the minimum (without popping): "."
  ‡        # Replace all "/" with "." (the transliterate ignores the trailing "."
           # in "/." since the strings are of unequal length)
   In      # Push the input, and square it
     .D    # Duplicate this string of "."s that many times
»          # Join all strings on the stack by newlines
           # (after which the result is output implicitly)

05AB1E (legacy), 30 29 bytes

'-×'/.ø©Ð„|.‡I.D®W'.:ÐW‡In.D»

Uses the legacy version of 05AB1E because it can take the minimum character of a string (based on its unicode value), saving 2 bytes over repushing the characters.

Try it online or verify all test cases.

Explanation:

'-×      '# Repeat "-" the (implicit) input amount of times as string
   '/.ø  '# Surround it with leading/trailing "/"
       ©  # Store this string in variable `®` (without popping)
Ð         # Triplicate it
 „|.‡     # Transliterate the "/" to "|" and "-" to "." in the other copy (the
          # transliterate ignores the trailing "…---/" since the strings are
          # of unequal length)
     I.D  # Duplicate it the input amount of times
®         # Push string `®`
 W        # Push the minimum (without popping): "-"
  '.:    '# Replace all "-" with "." in string `®`
Ð         # Triplicate it
 W        # Push the minimum (without popping): "."
  ‡       # Replace all "/" with "." (transliterate again ignores the trailing
          # "…---/")
   In     # Push the input, and square it
     .D   # Duplicate this string of "."s that many times
»         # Join all strings on the stack by newlines
          # (after which the result is output implicitly)
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading