I built a DFS maze generator a while back. It actually uses a the DFS algorithm, as opposed to KermMartian's misnamed generator, which returns long-corridor mazes. Any help in optimizing would be greatly appreciated.
Code:
Code:
::"DFS mazemaker
::"FFFDC441D55FD111DFFDC401F7F7D411D5D5D515D57DC501DDFDC101FFFFFFFF
:If G
:Goto C
:1→R
:AxesOff
:ClrDraw
:Vertical Xmin+∆X
:Shade(Ymin+∆Y,Ymax-∆Y,Xmin+∆X,,Xmax-∆X
:Vertical Xmax-∆X
:2→E:92→C
:{0→L₁
:Lbl C
:0→G
:Lbl B
:If getKey
:Goto D
:Pxl-Off(E,C
:0→H
:augment(randIntNoRep(1,4),{2→L₃
:Repeat H=5 or pxl-Test(E+2((D=3)-(D=1)),C+2((D=2)-(D=4
:H+1→H
:L₃(ans→D
:End
:If H=5
:Goto A
:R+1→R
:augment({D},L₁→L₁
:Pxl-Off(E+(D=3)-(D=1),C+(D=2)-(D=4
:E+2((D+3)-(D=1→E
:C+2((D=2)-(D=4→C
:Goto B
:Lbl A
:If 1=dim(L₁
:Stop
:L₁(1→D
:C+2(ans=4)-2(Ans=2→C
:E+2(D=1)-2(D=3→E
:∆List(cumSum(L₁→L₁
:Goto B
:Lbl D
:1→G
:ClrHome
:Output(1,1,round(100(R/1380),2
:Output 1,6,"percent