Quantcast
Channel: Solve the Halting Problem for Befinge - Code Golf Stack Exchange
Browsing all 12 articles
Browse latest View live

Answer by KrystosTheOverlord for Solve the Halting Problem for Befinge

Java, 477I know that this is not winning, n=and can probably be golfed more, but it implments a similar method as to what the other answers use, but this one uses hashmap to perform lookups. The input...

View Article


Answer by david for Solve the Halting Problem for Befinge

Befunge-98 (PyFunge), 217209 200 bytes#v10dpf1dp12dp3dpk>#v~:a-#v_$10dp1dg1+1dp >v >10dp;>0dg1dgp0dg1+0dp^;f1dp>0dg1dgg:'^-#v_n1-v^<v01_v#!->':<< >:'<-#v_01-0>...

View Article


Answer by 12Me21 for Solve the Halting Problem for Befinge

SmileBASIC, 158 145 bytesIf the same arrow is encountered more than once, the program will never halt.When the instruction pointer passes an arrow, it's replaced with a different symbol, which will...

View Article

Answer by nedla2004 for Solve the Halting Problem for Befinge

Python 2, 116 105 bytesx=1X=Y=y=0H=[]G=input()while(X,Y,x,y)not in H:H+=[(X,Y,x,y)];C=ord(G[Y][X]);x=C%3-1;y=C%5-1;X+=x;Y+=yTry it online!The challenge is old, but I figured since this is the shortest...

View Article

Answer by l4m2 for Solve the Halting Problem for Befinge

JavaScript (Node.js), 80 bytesf=(a,v=1,x=0,[t,...u]=a,n=1+a.search``,c=a[x])=>t?f(a,v=+c?c-2||v:c+n,x-v,u):!cTry it online!JavaScript (Node.js), 86...

View Article


Answer by ceilingcat for Solve the Halting Problem for Befinge

Python 2/3, 201 192 bytesdef f(x): X=Y=b=0;a=1;D={} while len(x)>Y>-1<X<len(x[Y]): try: a,b={'>':(1,0),'^':(0,-1),'<':(-1,0),'v':(0,1)}[x[Y][X]] if(X,Y)in D:return 0 except:0...

View Article

Answer by NikoNyrh for Solve the Halting Problem for Befinge

Clojure, 143 bytes#((fn[p v i s](if-let[v({\> 1\< -1\^(- s)\. v\v s}(get % p))](if(neg? i)1(recur(+ p v)v(dec i)s))))0 1 1e9(+(count(take-while(set"<>v^.")%))1))A function with 4 state...

View Article

Answer by zeppelin for Solve the Halting Problem for Befinge

ES6 (JavaScript), 111,101 bytesEDIT: changed output values to true and false, instead of Y and N, to shave off 10 bytes...

View Article


Answer by Neil for Solve the Halting Problem for Befinge

JavaScript (ES6), 158 127 bytesf=(a,x=0,y=0,d=1,e=0,c=a[y]&&a[y][x])=>c<'~'?(c>'.'&&(a[y][x]='~',d=(c=='>')-(c=='<'),e=(c=='v')-(c=='^')),f(a,x+d,y+e,d,e)):!cTakes input...

View Article


Answer by Destructible Lemon for Solve the Halting Problem for Befinge

Turtlèd, 146 bytes!u[*.[ r+.]l[ l]dr_+]#*#[ u]d[ (.r)(>.r{.r}@>)(v.d{.d}@v)(<.l{.l}@<)(^.u{.u}@^)(*@0' )],@1(0@0)(v' d)(<' r)(>' l)(^' d)[ u]d[ l]r[ [ r]l[ ' l]dr],This program takes...

View Article

Answer by Daniel for Solve the Halting Problem for Befinge

Python 2, 182 bytesm,v,d,x,y=input(),[],'>',0,0try: while 1: if[x,y]in v:print 0;break c=m[y][x] if c!='.':d=c;v+=[[x,y]] if d in'><':x+=[-1,1][d=='>'] else:y+=[-1,1][d=='v']except:print...

View Article

Solve the Halting Problem for Befinge

Let's define a simple 2D language, which we'll give the incredibly original name befinge. Befinge has 5 instructions:<>^v, as in most 2D esolangs, redirect the instruction pointer in their...

View Article
Browsing all 12 articles
Browse latest View live


Latest Images