It is vaguely based on the DFS, but not fully, so don't be too surprised.
If the syntax is weird, that's because it's Axe.
(To all you Axe programmers: If I could make this
faster, please tell me.)
For each pixel, it goes through, and, if the pixel is white and is a dead end or enclosed cell, changes one of the pixels around it to white, thus joining it to a neighboring pixel.
Note: Don't laugh at this; it is rather pathetic, but it does work about 90% of the time now.
The code:
Code:
Full
DiagnosticOff
For(A,0,48
Line(A*2,0,A*2,63
End
For(A,0,32
Line(0,A*2,95,A*2
End
DispGraph
For(θ,0,4
For(B,0,63
For(A,0,95
If pxl-Test(A,B)=0 and (pxl-Test(A-1,B)+pxl-Test(A,B-1)+pxl-Test(A+1,B)+pxl-Test(A,B+1)>2
rand ^4→C
If C=1
Pxl-Off(A-1,B
End
If C=2
Pxl-Off(A,B-1
End
If C=3
Pxl-Off(A+1,B
End
If C=4
Pxl-Off(A,B+1
End
End
DispGraph
End
End
Line(0,0,95,0
Line(0,0,0,63
Line(95,0,95,63
Line(0,63,95,63
End
DispGraph
Repeat getKey
End
ClrDraw
ClrHome