Simple golfing interpreter

13

2

Challenge:

Your job is to create a simple interpreter for a simple golfing language.


Input:

Input will be in the form of string separated by spaces.

You can replace space separation with what you want


Output:

Output the result (a number or a string) obtained after performing all operations. If there are more than one output join the together to give a single result (no separators). The variable's initial value is always zero. i.e: It start at 0


Language Syntax :

The language has following operators :

inc  ---> add one to variable
dec  ---> remove one from variable
mult ---> multiply variable by 2
half ---> divide the variable by 2
Pri  ---> print the variable to console (or whatever your language has)
exit ---> end the program (anything after this is ignored)

Examples:

inc inc inc dec Pri exit                 ---> 2
dec inc mult inc inc Pri                 ---> 2
inc inc inc mult half Pri exit inc       ---> 3
inc Pri inc Pri inc Pri exit half mult   ---> 123
Pri exit                                 ---> 0
inc half Pri exit                        ---> 0.5 

Restriction:

This is code-golf so shortest code in bytes for each language will win.


Note:

  • Input will always be valid . (string of operators separated with space)
  • You can round down to nearest integer if you don't want decimal places.

Muhammad Salman

Posted 2018-04-27T09:41:00.307

Reputation: 2 361

3Can I take a list of strings? Can I use another capitalization? – user202729 – 2018-04-27T10:02:42.700

Add exit case? exit should matter – l4m2 – 2018-04-27T12:01:17.553

@MuhammadSalman how many decimal places should we support? Is it okay if we round down when dividing? – user41805 – 2018-04-27T13:01:54.417

@Cowsquack : I guess 2 decimal places will be fine , although yeah you can round down if you want. – Muhammad Salman – 2018-04-27T13:03:17.493

So does that mean it is okay that inc half Pri gives 0 instead of 0.5? – user41805 – 2018-04-27T13:03:49.883

@l4m2 : What do you mean ? – Muhammad Salman – 2018-04-27T13:04:08.197

@Cowsquack : No , this should return 0.5 or 1 , No zero if even a single operation is performed. (I am willing to change it if it makes golfing easier since these things barely matter) – Muhammad Salman – 2018-04-27T13:06:06.437

@MuhammadSalman let's continue this conversation in chat

– user41805 – 2018-04-27T13:07:02.537

Is it possible to separate each printed value with newlines or should they all be on the same line ? – Kaldo – 2018-04-27T14:38:53.373

1@Kaldo : You can separate using new lines – Muhammad Salman – 2018-04-27T15:00:59.473

3Hmm, I wouldn't call that language "golfing language". – Paŭlo Ebermann – 2018-04-28T11:49:59.163

@PaŭloEbermann : Haha , Well I agree , but golfing language it is – Muhammad Salman – 2018-04-28T12:57:40.837

1

This is Deadfish with double and half instead of square and longer command names

– Jo King – 2018-04-30T03:42:41.860

Should Pri print out without newline? – idrougge – 2018-04-30T13:24:32.107

@idrougge : Yes – Muhammad Salman – 2018-04-30T14:38:11.050

Answers

8

Bash, 61 bytes

sed '1i0
s/.//2g;y"idmhe"+-*/q";/+\|-/i1
/*\|\//i2
/P/cdn'|dc

Try it online!

Converts the program into a dc program, then evaluates it as dc code. This takes the input separated by newlines. Note that dc is stack-based and uses reverse polish notation.

The input is first piped to sed

1i0 on the first line of input, insert (prepend) a 0, this will be the accumulator

s/.//2g remove everything but the first character on each line

y"idmhe"+-*/q" transliterate idmhe into +-*/q respectively, + - * / are the arithmetic commands and q quits the program

/+\|-/ on every line containing + or -, i1 insert a 1

/*\|\// on every line containing * or /, i2 insert a 2

/P/ on every line containing P, cdn change it into dn, equivalent to duplicate and output without newline in dc

Now this is evaluated as a dc expression.

user41805

Posted 2018-04-27T09:41:00.307

Reputation: 16 320

2I suppose it's not unreasonable to expect sed syntax to become even more alien than previously thought possible when golfing comes into play. – Mateen Ulhaq – 2018-04-28T11:48:41.820

6

Jelly, 21 bytes

ḲḢ€O%11ị⁾’‘j“IȮḤH”¤VI

Try it online!


Note that the ASCII values of the first characters (idmhPe) modulo 11 are unique modulo 6.


Using modulo 16:

Jelly, 21 bytes

ḲḢ€O%⁴ị“ḢwġḞkz’ṃØJ¤VI

Try it online!

The string that is used to index into is ḤH‘’IȮ in this case. The ‘’ are no longer on the boundaries.

user202729

Posted 2018-04-27T09:41:00.307

Reputation: 14 620

Using 11 bytes to represent a 6-byte string is... too bad. But... “” takes 2 bytes, ¤ takes 1 byte, the data itself takes 6 bytes, there are 2 bytes left to do something. Currently it's and j, but ịØJ or ṃØJ is much worse, and doesn't work (because Unicode). – user202729 – 2018-04-27T11:46:59.827

jli's string concept ("A string is a list of integers with a special flag to affect printing") is great. – user202729 – 2018-04-27T11:52:12.473

5

R, 128 125 bytes

Reduce(function(x,y)switch(y,i=x+1,d=x-1,m=x*2,h=x/2,P={cat(x);x}),substr(el(strsplit(gsub("e.*$","",scan(,""))," ")),1,1),0)

Try it online!

Must be called with source(echo=FALSE) to prevent the return value from being printed automatically. The alternative would be to wrap everything in invisible but that's much less golfy (and ruins my [still] nice byte count).

Giuseppe

Posted 2018-04-27T09:41:00.307

Reputation: 21 077

3

05AB1E, 25 bytes

΀¬"idmhPe"S"><·;=q"S‡J.V

Try it online!

Maps each of the language function with the corresponding 05AB1E function (using the first char of each function), and then executes the resulting string as 05AB1E code.

Kaldo

Posted 2018-04-27T09:41:00.307

Reputation: 1 135

2

Red, 121 bytes

func[s][v: 0 parse s[any[["i"(v: v + 1)|"d"(v: v - 1)|"m"(v: v * 2)|"h"(v: v / 2.0)|"P"(prin v)|"e"(exit)]thru" "| end]]]

Try it online!

Readable:

f: func [s] [
    v: 0
    parse s [
        any [
            [ "i" (v: v + 1)
            | "d" (v: v - 1)
            | "m" (v: v * 2)
            | "h" (v: v / 2.0)
            | "P" (prin v)
            | "e" (exit)]
            thru [" " | end]
        ]
    ]
] 

Galen Ivanov

Posted 2018-04-27T09:41:00.307

Reputation: 13 815

2

Python 2, 131 125 122 121 118 117 115 bytes

v=0;o=""
for x in input().split("x")[0].split():
 if"Q">x:o+=`v`
 else:v+=(1,-1,v,-v/2.)['idmh'.find(x[0])]
print o

Try it online!

-6 and -3 with thanks to @Rod

-3 and -2 with thanks to @etene

-1 by replacing "Pri"==x with "P"in x

ElPedro

Posted 2018-04-27T09:41:00.307

Reputation: 5 301

you can split on "exit" and get the 1st block, instead breaking saving 4 bytes

– Rod – 2018-04-27T12:16:52.797

1You can remove the parentheses around 'idmh' and use find instead of index, that will save a few bytes – etene – 2018-04-27T12:19:20.790

@Rod - can actually take that a bit further and split on exto save another 2 – ElPedro – 2018-04-27T12:25:05.280

You can replace v=(v+1,v-1,v*2,v/2.) with v+=(1,-1,v,-v/2.) it should work, didn't tested though – Rod – 2018-04-27T12:29:31.497

@Rod - thought about that but couldn't work out how to do the half. So simple! Thanks. – ElPedro – 2018-04-27T12:44:59.283

A bit dirty, but you can save 2 more bytes by replacing if"P"in x with if"Q">x – etene – 2018-04-27T14:08:49.427

@etene - Thanks. I didn't know that worked for whole strings. Thought it was just individual characters. – ElPedro – 2018-04-27T14:24:41.977

Look at my last edit, actually since str.find returns -1 if the substring isn't found, you can remove the last letter in 'idmh' and it works the same thanks to negative indexing. – etene – 2018-04-27T14:39:04.543

2

JavaScript (ES6), 83 79 bytes

Saved 4 bytes thanks to @l4m2

Iteratively replaces the instructions with either the output or empty strings.

s=>s.replace(/\S+./g,w=>m<s?'':w<{}?m:(m+={d:-1,e:w,i:1,m}[w[0]]||-m/2,''),m=0)

Try it online!

Commented

s =>                       // given the input string s
  s.replace(/\S+./g, w =>  // for each word w in s:
    m < s ?                //   if m is a string:
      ''                   //     ignore this instruction
    :                      //   else:
      w < {} ?             //     if w is 'Pri' ({} is coerced to '[object Object]'):
        m                  //       output the current value of m
      : (                  //     else:
          m +=             //       add to m:
            { d: -1,       //         -1 if w is 'dec'
              e: w,        //         w  if w is 'exit' (which turns m into a string)
              i: 1,        //         1  if w is 'inc'
              m            //         m  if w is 'mult'
            }[w[0]]        //       using the first character of w to decide
            || -m / 2,     //       or add -m/2 (for 'half') if the above result was falsy
        ''),               //       do not output anything
    m = 0                  //   m = unique register of our mighty CPU, initialized to 0
  )                        // end of replace()

Arnauld

Posted 2018-04-27T09:41:00.307

Reputation: 111 334

s=>s.replace(/\S+./g,w=>k<s?'':w<{}?k:(k+={d:-1,e:w,i:1,m:k}[w[0]]||-k/2,''),k=0) – l4m2 – 2018-04-28T05:36:55.930

@l4m2 This w<{} is pure evil :p – Arnauld – 2018-04-28T05:46:56.410

s=>s.replace(/\S+./g,e=>m<s?'':e<{}?m:(m+={d:-1,e,i:1,m}[e[0]]||-m/2,''),m=0) also work – l4m2 – 2018-04-28T05:52:02.647

2

Python 3, 110 91 82 bytes

exit will cause the program to exit with an error.

x=0
for c in input():c=='P'==print(x,end='');x+=(1,-1,x,-x/2,c,0)['ndmhx'.find(c)]

Try it online!

mbomb007

Posted 2018-04-27T09:41:00.307

Reputation: 21 944

Shorten your variable names to save 9 bytes. i='x+=1';d='x-=1';... and then in your exec call, change it to exec(eval(c[0])) – mypetlion – 2018-04-27T16:33:58.757

@mypetlion Thanks, but I found a better way. – mbomb007 – 2018-04-27T16:35:21.940

I think this is valid: 82 bytes

– Lynn – 2018-04-27T22:52:47.953

@Lynn That's great! I couldn't think of a nice way to short-circuit to the print statement! – mbomb007 – 2018-04-28T01:00:51.847

2

JavaScript (ES6), 77 75 bytes

(Borrowed (stole) @Arnauld's trick of using m as the variable name, saving 2 bytes.)

f=([c,...s],m=0)=>c<'x'?(c=='P'?m:'')+f(s,m+({h:-m/2,d:-1,n:1,m}[c]||0)):''

Recursively walks the string, looking for distinct letters per instruction and ignoring the rest:

  • n: inc
  • d: dec
  • m: mult
  • h: half
  • P: Pri
  • x: exit

Takes advantage of the fact that undefined is neither greater than nor less than 'x', causing the recursion to stop at the end of the string or when it encounters the 'x' in exit.

f=([c,...s],n=0)=>c<'x'?(c=='P'?n:'')+f(s,n+({h:-n/2,d:-1,n:1,m}[c]||0)):''

console.log(f('inc inc inc dec Pri exit'));                 //--> 2
console.log(f('dec inc mult inc inc Pri'));                 //--> 2
console.log(f('inc inc inc mult half Pri exit inc'));       //--> 3
console.log(f('inc Pri inc Pri inc Pri exit half mult'));   //--> 123
console.log(f('Pri exit'));                                 //--> 0
console.log(f('inc half Pri exit'));                        //--> 0.5 

Rick Hitchcock

Posted 2018-04-27T09:41:00.307

Reputation: 2 461

1Following up to your deleted comment to which I can of course no longer reply, I forgot to paste in the link to the corrected code (d'oh!) but I found a new approach that's 2 bytes shorter than my original attempt anyway. – Neil – 2018-04-30T00:01:36.857

2

Charcoal, 37 35 bytes

≔⁰ηF⎇№θx…θ⌕θxθ≡ιn≦⊕ηd≦⊖ηm≦⊗ηh≦⊘ηrIη

Try it online! Link is to verbose version of code. Inspired by @RickHitchcock's answer. Explanation:

≔⁰η

Clear the variable.

F⎇№θx…θ⌕θxθ≡ι

Truncate the input at the x if there is one, then loop over and switch on each character of (the remainder of) the input.

n≦⊕η

n increments the variable.

d≦⊖η

d decrements the variable.

m≦⊗η

m multiplies the variable by two (i.e. doubles).

h≦⊘η

h halves the variable.

rIη

r prints the variable cast to string.

Neil

Posted 2018-04-27T09:41:00.307

Reputation: 95 035

1@RickHitchcock Sorry, didn't test that thoroughly enough. I found a workaround but it cost me a byte. – Neil – 2018-04-27T19:26:29.407

1

JavaScript (Node.js), 107 bytes

f=s=>s.split` `.map(([o])=>F?0:o=="i"?i++:o=="d"?i--:o=="m"?i*=2:o=="h"?i/=2:o=="P"?S+=i:F=1,F=i=0,S="")&&S

Try it online!

DanielIndie

Posted 2018-04-27T09:41:00.307

Reputation: 1 220

Shaved off two bytes – None – 2018-04-27T11:06:16.877

This as it is should be counted as 105 bytes afaik, as long as your function doesn't call itself you don't need to count f= – Brian H. – 2018-04-27T11:56:44.817

1

JavaScript, 107 bytes

s=>eval('x=0;x'+(s.split` `.map(v=>({i:"++",d:"--",m:"*=2",h:"/=2",P:";alert(x)",e:"//"})[v[0]]).join`;x`))

Brian H.

Posted 2018-04-27T09:41:00.307

Reputation: 513

1

JavaScript (Node.js), 91 bytes

_=>_.split` `.map(o=>o<{}>!_?S+=+i:o<"e"?i--:o<"f"?++_:o<"i"?i/=2:o<"j"?i++:i*=2,i=S="")&&S

Try it online!

JavaScript (Node.js), 96 bytes

_=>_.split` `.map(o=>F?0:o<"Q"?S+=i:o<"e"?i--:o<"f"?F=1:o<"i"?i/=2:o<"j"?i++:i*=2,F=i=0,S="")&&S

Try it online!

JavaScript (Node.js), 99 bytes

s=>s.split` `.map(_=>eval('++i7--i7++e7u+=+i7i*=27i/=2'.split(7)[Buffer(e+_)[0]%11%6]),e=i=u='')&&u

Try it online!

l4m2

Posted 2018-04-27T09:41:00.307

Reputation: 5 985

1

Python 3, 114 110 109 116 bytes

Actually would have taken two bytes less in Python 2 because exec is a statement and doesn't need parentheses...

  • Saved 4 extra bytes thanks to @ElPedro

  • Saved an extra byte by taking advantage of the fact that find returns -1 on error, which can then be used as an index

  • +7 bytes because I hadn't noticed the no-newlines rule :(

i=0;exec(";".join("i+=1 i-=1 i*=2 i/=2 print(i,end='') exit()".split()["idmhP".find(h[0])]for h in input().split()))

Try it online!

Maps the first character of every input word to a piece of Python code. These are then concatenated and execed.

Pretty straightforward approach, that could probably be golfed a bit more. The difficulty mostly resides in finding the shortest form out of many possible ones...

etene

Posted 2018-04-27T09:41:00.307

Reputation: 448

112 Try it online! if you have the commands as a space seperated string and split it.

– ElPedro – 2018-04-27T13:13:29.037

1

110 in fact as the brackets can go Try it online!

– ElPedro – 2018-04-27T13:31:41.080

This doesn't give the correct output. The question says you must print without separators, so you need print(i,end=''). See the 4th test case. – mbomb007 – 2018-04-27T15:52:13.987

I hadn't noticed, I'll fix it. Thanks ! – etene – 2018-04-27T16:05:55.463

@etene Comment when you've fixed it and I'll remove my downvote. – mbomb007 – 2018-04-28T01:03:07.233

1

Ruby + -na, 81 73 65 bytes

x=0;$F.map{|w|eval %w{x+=1 x-=1 1/0 $><<x x*=2 x/=2}[w.ord%11%6]}

Try it online!

Pretty straightforward. For the first letter of each word, find the corresponding command string and eval it. Uses integer division, and exits by throwing a ZeroDivisionError.

-5 bytes: Use .ord%11%6 instead of a string lookup. Credit goes to user202729

-3 bytes: .ord only considers the first character of the string, so I can skip a [0].

-8 bytes: Use -a flag to automatically split input, thanks to Kirill L.

benj2240

Posted 2018-04-27T09:41:00.307

Reputation: 801

1

You can save even more bytes by adding -a option to do the autosplit for you, like this

– Kirill L. – 2018-05-02T08:55:54.840

1

Haskell, 93 bytes

(0!)
a!(c:t)|c=='P'=show a++a!t|c>'w'=""|1<2=(a+sum(lookup c$zip"ndmh"[1,-1,a,-a/2]))!t;a!e=e

Try it online!

Essentially a translation of mbomb007's Python answer.

Lynn

Posted 2018-04-27T09:41:00.307

Reputation: 55 648

1

Lua, 207 bytes

s=0;n=0;for a in io.read():gmatch'.'do if s==0 then s=1;n=a=='i'and n+1 or a=='d'and n-1 or a=='m'and n*2 or a=='h'and n/2 or n;if a=='P'then print(n)elseif a=="e"then break end elseif a==' 'then s=0 end end

Jujhar Singh

Posted 2018-04-27T09:41:00.307

Reputation: 111

1

Emojicode, 270 bytes

c 0j jincc➕c 1jdecc➖c 1jmultc✖️c 2jhalfc➗c 2jPric 10

Try it online!



c 0
j 
jincc➕c 1
jdecc➖c 1
jmultc✖️c 2
jhalfc➗c 2
jPric 10



 inc inc inc dec Pri exit

 dec inc mult inc inc Pri

 inc inc inc mult half Pri exit inc

 inc Pri inc Pri inc Pri exit half mult

 Pri exit

 inc half Pri exit

X1M4L

Posted 2018-04-27T09:41:00.307

Reputation: 1 586

0

SNOBOL4 (CSNOBOL4), 165 bytes

	P =INPUT ' exit ' 
	x =0
S	P LEN(1) $ L ARB ' ' REM . P	:S($L)F(end)
i	X =X + 1	:(S)
d	X =X - 1	:(S)
P	O =O X		:(S)
m	X =X * 2	:(S)
h	X =X / 2.	:(S)
e	OUTPUT =O
END

Try it online!

Gross.

	P =INPUT ' exit ' 				;* append ' exit ' to the input to guarantee that the program will stop
	x =0						;* initialize x to 0 else it won't print properly if the program is 'Pri'
S	P LEN(1) $ L ARB ' ' REM . P	:S($L)F(end)	;* set L to the first letter of the word and goto the appropriate label
i	X =X + 1	:(S)
d	X =X - 1	:(S)
P	O =O X		:(S)				;* append X to the output string
m	X =X * 2	:(S)
h	X =X / 2.	:(S)				;* divide by 2. to ensure floating point
e	OUTPUT =O					;* print whatever's in O, which starts off as ''
END

Giuseppe

Posted 2018-04-27T09:41:00.307

Reputation: 21 077

0

C# (.NET Core), 186 Bytes

class P{static void Main(string[]a){int v=0;foreach(var s in a){var i=s[0];if(i=='i')v++;if(i=='d')v--;if(i=='m')v*=2;if(i=='h')v/=2;if(i=='P')System.Console.Write(v);if(i=='e')break;}}}

Romen

Posted 2018-04-27T09:41:00.307

Reputation: 161

You can shave 26bytes off this by doing a few simple things, like declaring i with v, consulting an ASCII table so you can use small numbers, rearranging the ifs, and then using a ternary: class Z{static void Main(string[]a){int v=0,i;foreach(var s in a){i=s[0]%'d';if(i==1)break;if(i>9)System.Console.Write(v);else v=i<1?v-1:i<5?v/2:i<6?v+1:v*2;}}} (P.S. an explanation of how it works and how to use it (e.g. expects command line args) is always appreciated!) – VisualMelon – 2018-04-28T07:43:33.863

(Oh that is embarrassing... I should have use %50 instead of %'d') – VisualMelon – 2018-04-28T07:51:03.220

0

Perl 5 -a, 61 bytes

eval'$,'.qw(++ -- ;exit ;print$,||0 *=2 /=2)[(ord)%11%6]for@F

Try it online!

Stole @user202729's ord%11%6 trick

How?

-a            # split the input by whitespace, store in @F
eval          # Execute the string that results from:
'$,'          # $, (the accumulator)
.             # appending:
qw(           # create an array for the following whitespace separated values:
++ --            # operators for inc & dec
;exit            # exit
;print$,||0      # Pri  (||0 ensures that 0 is output if accumulator is null
*=2 /=2)         # mult div
[(ord)%11%6] # @user202729's trick selects one of the preceding operations
for@F        # for every term input

Xcali

Posted 2018-04-27T09:41:00.307

Reputation: 7 671

0

C (gcc), 120 114 111 bytes

-6 bytes thanks to ceilingcat.

x,d;f(char*s){for(x=0;s>1;s=index(d^1?s:"",32)+1)d=*s-100,x+=d?d==5:-1,x*=d^9?d^4?1:.5:2,d+20||printf("%d",x);}

Try it online!

124 bytes

Floating-point version:

d;f(char*s){for(float f=0;s>1;s=strchr(s,32)+1)d=*s-80,f+=d==25,f-=d==20,f*=d^29?d^24?1:.5:2,s=d^21?s:"",d?:printf("%f",f);}

Try it online!

I did not bother with a version that rounds down, but makes an exception for 0, which would be allowed, if I understand the comment-chain correctly.

gastropner

Posted 2018-04-27T09:41:00.307

Reputation: 3 264

0

Pyth, 44 Bytes

Vmx"idmhPe"hdcwd=Z@[hZtZyZcZ2ZZ)NIqN4pZIqN6B

Test Suite

explanation

Vmx"idmhPe"hdcwd=Z@[hZtZyZcZ2ZZ)NIqN4pZIqN6B   ## full program
             cwd                               ## split input on space
Vmx"idmhPe"hd                                  ## iterate through list of numbers corresponding to operators
                =Z@[hZtZyZcZ2ZZ)N              ## assign the variable Z (initialliy Zero) it's new value
                                 IqN4pZ        ## print Z if the current operator is "Pri" (4)
                                       IqN6B   ## break if the current operator is "exit" (5)

KarlKastor

Posted 2018-04-27T09:41:00.307

Reputation: 2 352

0

TI-BASIC, 112 bytes

This takes advantage of some assumptions that are AFAIK perfectly acceptable. Number one being that all variables are initialized to zero prior to execution; number two being that input is taken via Ans.

Ans+" E→Str1
While 1
I+4→I
sub(Str1,I-3,1→Str2
A+(Ans="I")-(Ans="D
If inString("MH",Str2
Then
I+1→I
2AAns+A/2(1-Ans
End
If Str2="P
Disp A
If Str2="E
Stop
Ans→A
End

kamoroso94

Posted 2018-04-27T09:41:00.307

Reputation: 739

0

Java (OpenJDK 8), 164 bytes

a->{int c=0;for(String g:a.split(" ")){char b=g.charAt(0);if(b==105)c++;if(b==100)c--;if(b==109)c*=2;if(b==104)c/=2;if(b==80)System.out.print(c);if(b==101)return;}}

Try it online!

Above is my solution that rounds off to integers, but below is my solution that handles decimals. The obnoxious way that java prints doubles adds another 55 byes to the score. I left the new lines to make the code more readable in the second submission only because it’s essentially the same solution with one extra command and an import statement.

Java (OpenJDK 8), 219 bytes

a->{
double c=0;
for(String g:a.split(" ")){
char b=g.charAt(0);
if(b==105)c++;
if(b==100)c--;
if(b==109)c*=2;
if(b==104)c/=2;
if(b==80)System.out.print(new DecimalFormat("0.#").format(c));
if(b==101)return;}}

Try it online!

X1M4L

Posted 2018-04-27T09:41:00.307

Reputation: 1 586

0

33, 62 bytes

s'i'{1a}'d'{1m}'m'{2x}'h'{2d}'P'{o}'e'{@}It[mzsjk""ltqztItn1a]

Try it online!

This program takes the instructions delimited by newlines

Explanation:

It[mzsjk""ltqztItn1a]
  [mz            n1a] | Forever
It    jk       It     | - Get the first character of the next instruction
            qz        | - Call the function declared previously
     s  ""lt  t       | - Make sure we don't lose track of the variable

The code before that segment defines all the functions.

TheOnlyMrCat

Posted 2018-04-27T09:41:00.307

Reputation: 1 079