Skip to main content
Commonmark migration
Source Link
added 1668 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

TODO: Will golf it down some more tomorrow morning and add an explanation.

ć¡             # Split the input-string on its first character ('B')
               #  i.e. "BIDABIDIBIDOBIDABIDUBUBIDUBIDI"
               #   → ["IDA","IDI","IDO","IDA","IDU","U","IDU","IDI"]
  Ç            # Convert each character to it's ordinal value
               #  → [[73,68,65],[73,68,73],[73,68,79],[73,68,65],[73,68,85],85,[73,68,85],[73,68,73]]
   1^          # XOR it by 1
               #  → [[72,69,64],[72,69,72],[72,69,78],[72,69,64],[72,69,84],84,[72,69,84],[72,69,72]]
     9%        # Take modulo-9
               #  → [[0,6,1],[0,6,0],[0,6,6],[0,6,1],[0,6,3],3,[0,6,3],[0,6,0]]
       4%      # Take Modulo-4
               #  → [[0,2,1],[0,2,0],[0,2,2],[0,2,1],[0,2,3],3,[0,2,3],[0,2,0]]
ε         ]    # Now map it to:
 Dg≠i          # If the length is not 1:
               #  i.e. [0,2,1] → 3 → 1 (truthy)
               #  i.e. 3 → 1 → 0 (falsey)
     421øP     # Multiply the first number by 4, second by 2, and third by 1
               #  i.e. [0,2,1] and [4,2,1] → [[0,4],[2,2],[1,1]] → [0,4,1]
           €O  # Then sum every inner list
               #  [[0,4,1],[0,4,0],[0,4,2],[0,4,1],[0,4,3],3,[0,4,3],[0,4,0]]
               #   → [5,4,6,5,7,3,7,4]
žvβ            # Convert this list from base-16 to base-10
               #  → 1415934836
   žzв         # Convert this integer from base-10 to base-256
               #  → [84,101,115,116]
      ç        # Convert this number to ASCII characters
               #  → ["T","e","s","t"]
       J       # Join the characters together (and output implicitly)
               #  → "Test"

TODO: Will golf it down some more tomorrow morning and add an explanation.

ć¡             # Split the input-string on its first character ('B')
               #  i.e. "BIDABIDIBIDOBIDABIDUBUBIDUBIDI"
               #   → ["IDA","IDI","IDO","IDA","IDU","U","IDU","IDI"]
  Ç            # Convert each character to it's ordinal value
               #  → [[73,68,65],[73,68,73],[73,68,79],[73,68,65],[73,68,85],85,[73,68,85],[73,68,73]]
   1^          # XOR it by 1
               #  → [[72,69,64],[72,69,72],[72,69,78],[72,69,64],[72,69,84],84,[72,69,84],[72,69,72]]
     9%        # Take modulo-9
               #  → [[0,6,1],[0,6,0],[0,6,6],[0,6,1],[0,6,3],3,[0,6,3],[0,6,0]]
       4%      # Take Modulo-4
               #  → [[0,2,1],[0,2,0],[0,2,2],[0,2,1],[0,2,3],3,[0,2,3],[0,2,0]]
ε         ]    # Now map it to:
 Dg≠i          # If the length is not 1:
               #  i.e. [0,2,1] → 3 → 1 (truthy)
               #  i.e. 3 → 1 → 0 (falsey)
     421øP     # Multiply the first number by 4, second by 2, and third by 1
               #  i.e. [0,2,1] and [4,2,1] → [[0,4],[2,2],[1,1]] → [0,4,1]
           €O  # Then sum every inner list
               #  [[0,4,1],[0,4,0],[0,4,2],[0,4,1],[0,4,3],3,[0,4,3],[0,4,0]]
               #   → [5,4,6,5,7,3,7,4]
žvβ            # Convert this list from base-16 to base-10
               #  → 1415934836
   žzв         # Convert this integer from base-10 to base-256
               #  → [84,101,115,116]
      ç        # Convert this number to ASCII characters
               #  → ["T","e","s","t"]
       J       # Join the characters together (and output implicitly)
               #  → "Test"
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#05AB1E, 30 bytes

ć¡Ç1^9%4%εDg≠i421øP]€OžvβžzвçJ

Port of @Dennis' insane Jelly answer (just with less convenient builtins). So make sure to upvote him!

Try it online or verify all test cases.

Explanation:

TODO: Will golf it down some more tomorrow morning and add an explanation.