Answer by DLosc for Interpret TwoMega
Pip, 75 71 byteslPB0aR:^"!><[].^_""!:_--viPU0++vW_{}O_i@v:!_LFBilPB0l@FBi"^n;VauTry it online!Translates the 2Ω code into equivalent Pip code and evaluates it.We use i to represent the tape, v...
View ArticleAnswer by Lynn for Interpret TwoMega
Python 2, 167 bytest=h=I=0m=1E=''for c in input():i='[<>!.^]'.find(c);E+=''*I+'while+2**t&h: m/=2 m*=2 h^=2**t print+(2**t&h>0) t=t&~m|m*(2**t&h<1)...
View ArticleAnswer by fergusq for Interpret TwoMega
Python 3, 297284 274 bytes-10 bytes thanks to ovs and Jonathan AllanC=input()h={}t=set()def f(C,p): c=C[0];r=hash(frozenset(t));v=h.get(r,0) p={"<":p-1,">":p+1}.get(c,p) if'"'>c:h[r]=not v...
View ArticleAnswer by l4m2 for Interpret TwoMega
JavaScript (Node.js), 148 bytesx=>eval(x.replace(e=/./g,c=>({'<':'u/=2','>':'u*=2','!':'e[v]^=1','.':'alert(+!!e[v])','^':'v=(v|u)^u*e[v]','[':'while(e[v]){'}[c]||'}')+';',v=u=1))Try it...
View ArticleInterpret TwoMega
In this challenge, you will write an interpreter for 2Ω (transcribed as TwoMega), a language based loosely on brainfuck with an infinite-dimensional storage space.The Language2Ω contains three pieces...
View Article
More Pages to Explore .....