Problem

Description: I once took a nap on my keyboard. I dreamed of a brand new language, but I could not decipher it nor get its meaning. Can you help me? Hint: Replace the spaces with either ‘{’ or ‘}’ in the solution. Hint: Interpreters don’t help. Operations write to the current index.

(rev80, solved by 95)

Attachment: rev80.zip

Solution

$ cat task/priner.tb
## %% %++ %++ %++ %# *&* @** %# **&* ***-* ***-* %++ %++ @*** *-* @*** @** *+** @*** ***+* @*** **+** ***+* %++ @*** #% %% %++ %++ %++ %++ @* %# %++ %++ %++ %% *&** @* @*** *-** @* %# %++ @** *-** *-** **-*** **-*** **-*** @** @*** #% %% %++ %++ %++ %++ %# *+** %++ @** @* %# *+** @*** ## %% @***

It took some time to find out what language this is, but since the title of the challenge is Eso Taaape, you could see this as a hint towards esoteric languages and something tape based. We found out it was the relatively unknown language TapeBagel.

The existing implementation in perl seemed a bit broken and did not seem to like the provided code.

So I put on my robe and a wizard hat and did some attack python-fu. It ain’t pretty but i wrote it in just a couple of minutes. Behold, the TapeBagel interpreter!

s = "## %% %++ %++ %++ %# *&* @** %# **&* ***-* ***-* %++ %++ @*** *-* @*** @** *+** @*** ***+* @*** **+** ***+* %++ @*** #% %% %++ %++ %++ %++ @* %# %++ %++ %++ %% *&** @* @*** *-** @* %# %++ @** *-** *-** **-*** **-*** **-*** @** @*** #% %% %++ %++ %++ %++ %# *+** %++ @** @* %# *+** @*** ## %% @*** "

tokens = s.strip().split(' ')

out = ""
ints = [0, 0, 0, 0, 0]
index = 0
for t in tokens:
    if (t == '%%'):
        index = 0
    elif (t == '%++'):
        ints[index] += 1
    elif (t == '%#'):
        index += 1
    elif (t == '##'):
        ints[0] = 0
        ints[1] = 0
        ints[2] = 0
    elif (t == '#%'):
        ints[0] = 1
        ints[1] = 1
        ints[2] = 1

    elif (t == '*&*'):
        ints[index] = ints[0] * ints[0]
    elif (t == '**&*'):
        ints[index] = ints[1] * ints[0]
    elif (t == '***&*'):
        ints[index] = ints[2] * ints[0]
    elif (t == '*&**'):
        ints[index] = ints[0] * ints[1]
    elif (t == '**&**'):
        ints[index] = ints[1] * ints[1]
    elif (t == '***&**'):
        ints[index] = ints[2] * ints[1]
    elif (t == '*&***'):
        ints[index] = ints[0] * ints[2]
    elif (t == '**&***'):
        ints[index] = ints[1] * ints[2]
    elif (t == '***&***'):
        ints[index] = ints[2] * ints[2]

    elif (t == '*-*'):
        ints[index] = ints[0] - ints[0]
    elif (t == '**-*'):
        ints[index] = ints[1] - ints[0]
    elif (t == '***-*'):
        ints[index] = ints[2] - ints[0]
    elif (t == '*-**'):
        ints[index] = ints[0] - ints[1]
    elif (t == '**-**'):
        ints[index] = ints[1] - ints[1]
    elif (t == '***-**'):
        ints[index] = ints[2] - ints[1]
    elif (t == '*-***'):
        ints[index] = ints[0] - ints[2]
    elif (t == '**-***'):
        ints[index] = ints[1] - ints[2]
    elif (t == '***-***'):
        ints[index] = ints[2] - ints[2]

    elif (t == '*+*'):
        ints[index] = ints[0] + ints[0]
    elif (t == '**+*'):
        ints[index] = ints[1] + ints[0]
    elif (t == '***+*'):
        ints[index] = ints[2] + ints[0]
    elif (t == '*+**'):
        ints[index] = ints[0] + ints[1]
    elif (t == '**+**'):
        ints[index] = ints[1] + ints[1]
    elif (t == '***+**'):
        ints[index] = ints[2] + ints[1]
    elif (t == '*+***'):
        ints[index] = ints[0] + ints[2]
    elif (t == '**+***'):
        ints[index] = ints[1] + ints[2]
    elif (t == '***+***'):
        ints[index] = ints[2] + ints[2]

    elif (t == '@*'):
        out += chr(ord('@') + ints[0])
    elif (t == '@**'):
        out += chr(ord('@') + ints[1])
    elif (t == '@***'):
        out += chr(ord('@') + ints[2])
    else:
        print "unhandled", t

print out

The output was IW@ILOVETAPEBAGEL@.

Flag: IW{ILOVETAPEBAGEL}