fcn make_maze(w = 16, h = 8){ // make arrays with lists of lists (all mutable) vis:=(w.pump(List().write,0)+1)*h + w.pump(List().write,1); ver:=(w.pump(List().write,T(Void,"| ")) + "|")*h + T; hor:=(w.pump(List().write,T(Void,"+---")) + "+")*(h + 1); fcn(x,y,vis,ver,hor){ vis[y][x] = 1; d:=L(T(x - 1, y), T(x, y + 1), T(x + 1, y), T(x, y - 1)).shuffle(); foreach xx,yy in (d){ if(vis[yy][xx]) continue; if(xx==x) hor[y.max(yy)][x]="+ "; if(yy==y) ver[y][x.max(xx)]=" "; self.fcn(xx,yy,vis,ver,hor); } }((0).random(w),(0).random(h),vis,ver,hor); foreach a,b in (hor.zip(ver)) { println(a.concat(),"\n",b.concat()) } return(ver,hor); } make_maze();