52
2
While I was traveling in the future, I noticed a funny game among kids circa 2275. When they don't want their great-great-great-great-grand parents to understand what they're saying, they use the BIBABOBU speak. Obviously, I couldn't understand anything either with my pre-cyborg era brain and I felt (or technically: I will feel) really silly. So, I'd need a decoder for my next visit.
BIBABOBU?
While it's been deprecated for a long time, ASCII is still commonly used in the pop culture of 2275 and this language is based upon it.
A string is BIBABOBU-encoded that way:
- Convert all characters to their ASCII codes.
Take the 2-digit hexadecimal representation of each code and convert them using the following table:
0: BI 4: BIDI 8: BADI C: BODI 1: BA 5: BIDA 9: BADA D: BODA 2: BO 6: BIDO A: BADO E: BODO 3: BU 7: BIDU B: BADU F: BODU
Example
"Hello!" → 48 65 6C 6C 6F 21 → "BIDIBADI BIDOBIDA BIDOBODI BIDOBODI BIDOBODU BOBA"
However, the corresponding input would be given without any space to mimic the monotonous intonation that kids are using to make this even harder to understand without implants:
"BIDIBADIBIDOBIDABIDOBODIBIDOBODIBIDOBODUBOBA"
Clarifications and rules
- Remember that I need a decoder, not an encoder.
- Decoded characters are guaranteed to be in the range [ 32...126 ].
- The input is guaranteed to contain en even number of BIBABOBU-encoded hexadecimal digits.
- You may take input in either full lowercase or full uppercase. Mixed cases are not allowed.
- Because bit flips are quite common during a time travel, this is code-golf in order to minimize the risks.
Test cases
NB: Linefeeds are used below for formatting purposes only. You are not supposed to handle them.
Input:
BIDABIDIBIDOBIDABIDUBUBIDUBIDI
Output:
Test
Input:
BIDABIDUBIDOBIDABIDOBODIBIDOBUBIDOBODUBIDOBODABIDOBIDABOBIBIDUBIDIBIDOBODUBOBIBUBOBUBOBUBI
DUBUBIDABOBA
Output:
Welcome to 2275!
Input:
BIDIBADIBIDOBIDABIDOBODIBIDOBODIBIDOBODUBOBODIBOBIBIDABIDIBIDOBADABIDOBODABIDOBIDABOBIBIDA
BIDIBIDUBOBIDOBABIDUBIDOBIDOBIDABIDOBODIBIDOBIDABIDUBOBOBABOBIBIDABADABIDOBODUBIDUBIDABOBI
BIDOBODIBIDOBODUBIDOBODUBIDOBADUBOBIBIDUBUBIDOBODUBOBIBIDOBIDOBIDUBIDABIDOBODOBIDOBODOBIDU
BADABOBA
Output:
Hello, Time Traveler! You look so funny!
Input:
BIDIBABIDOBODOBIDOBIDIBOBIBIDUBADABIDOBODUBIDUBIDABOBIBIDOBIDIBIDOBODUBIDOBODOBOBIDUBIDUBI
DIBOBIBIDUBIDABIDOBODOBIDOBIDIBIDOBIDABIDUBOBIDUBUBIDUBIDIBIDOBABIDOBODOBIDOBIDIBOBIBIDUBI
DUBIDOBADIBIDOBABIDUBIDIBOBIBIDIBADABOBIDUBIDOBODABOBIBIDUBUBIDOBABIDUBADABIDOBADABIDOBODO
BIDOBIDUBOBODIBOBIBIDOBIDIBIDOBODUBOBIBIDUBADABIDOBODUBIDUBIDABUBODUBOBIBIDIBADIBIDOBABOBI
BIDOBADIBIDOBABOBIBIDOBADIBIDOBABOBA
Output:
And you don't understand what I'm saying, do you? Ha ha ha!
I like the challenge, but I would have liked it slightly better if the encoding was lexicographically sorted. – Stewie Griffin – 2018-08-29T08:57:44.160
4@StewieGriffin These damn kids are mischievous... :-/ – Arnauld – 2018-08-29T09:04:04.447
12By the way, I find the story really really unlikely! I wouldn't be surprised if it was just a dream you had... might you have a CO leak in your house? – Stewie Griffin – 2018-08-29T09:09:47.387
12Ah... That would also explain the ponies riding rainbows in my living room! – Arnauld – 2018-08-29T09:13:10.523
2"Because bit flips are quite common during a time travel" - err shouldn't it be radiation-hardened then? – Jonathan Allan – 2018-08-29T10:07:22.367
1Do you need a decoder for the actual BIBABOBU speak, or just for the written down version? – Mr Lister – 2018-08-29T10:30:06.980
1@MrLister The written down version is fine. :) – Arnauld – 2018-08-29T10:34:44.520
1... but not nearly as great a challenge. – Mr Lister – 2018-08-29T10:36:42.133
@MrLister That would be another kettle of fish indeed. Here is the only voice decoding challenge I've been able to find.
– Arnauld – 2018-08-29T10:47:20.5709One could argue that golfed code increases the severity of a bit-flip (less redundancy within the code) even if it decreases the frequency of a bit-flip... but whatever :) - Nice challenge! – JayCe – 2018-08-29T12:53:01.157
4@JayCe True. I was more thinking along the lines: the smaller the code, the more redundancy you can get by storing multiple copies. – Arnauld – 2018-08-29T13:01:53.227
^ Of course... this makes sense. – JayCe – 2018-08-29T13:05:17.127
Of course, this implies that immortality will be invented circa or before 2125. – Erik the Outgolfer – 2018-08-29T14:17:44.250
@JonathanAllan If that solves the problem, then those bit flips would be pretty weird, since they would always restrict themselves to one byte. – Erik the Outgolfer – 2018-08-29T14:25:37.350
4Sorry, I want to like this challenge, but the premise of the question is clearly ridiculous. ASCII will never be deprecated. – scatter – 2018-08-30T13:44:43.370
It is bugging me that the encoding table is not a Huffman tree (properly organized to use the shortest phonemes for the most common symbols, of course). – zwol – 2018-08-30T20:38:36.677
1I’m pretty sure that technically you willan on-when presooning on-feelenta silly in this situation; the correct tense to use here is surely the Future Subinverted Plagal Retropast. – Janus Bahs Jacquet – 2018-09-02T08:38:22.163