Post by dw817 on Feb 23, 2013 21:22:45 GMT -5
This may have gotten lost in the shuffle. Came across it in my files.
Unlike other Maze Makers, this one gives you a chance to watch it being made and learn how they are constructed.
And it requires no additional files to plot solid colored blocks !
Might be of interest to those of you wanting to kick back to old-school Atari-style graphics.
Either copy from HERE or download the binary attachment:
Unlike other Maze Makers, this one gives you a chance to watch it being made and learn how they are constructed.
And it requires no additional files to plot solid colored blocks !
Might be of interest to those of you wanting to kick back to old-school Atari-style graphics.
Either copy from HERE or download the binary attachment:
' ______________________________________
' // //
' // Smart N' Sweet Maze Maker v0.02 //
' // Written by David W - May 2009 //
'//___________________________________//
dim sizex=32,sizey=32 ' change to size of maze you want (must be EVEN # !)
dim map(sizex,sizey)
dim a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
dim ax,ay
dim watch=1 ' change to 0 for instant maze making
' // FUNCTIONS //
function rn(n):return rnd()%n:endfunction
function bound(a,b,c):if a<b then return b elseif a>c then return c else return a endif:endfunction
function mymap(x,y):return map(bound(x,0,sizex),bound(y,0,sizey)):endfunction
function bricks(x,y):dim i,j,c:for i=-1to 1:for j=-1to 1:if mymap(x+j,y+i)=0then c=c+1endif
next:next:return c:endfunction
' // SUBROUTINES //
sub update():dim i,j:for i=0 to sizey:for j=0 to sizex:locate j,i
if map(j,i)=0then color(0,0,0)elseif map(j,i)=1then color(192,128,64)else color(-1,0,0)endif
print"/";:next:next:drawtext():endsub
' /// MAIN PROGRAM BEGINS ///
textmode(text_buffered):settextscroll(0):font(-1):resizetext(sizex+1,sizey+1)
for i=0to sizey
for j=0to sizex
if(j*i)%2=0then map(j,i)=1elseif j*i>0and j<sizex and i<sizey then c=c+1endif
next
next
do
if f+watch=2then
map(x,y)=2
update()
do
sleep(15)
loop until inkey$()>""
map(x,y)=0
endif
do
if e=0then
e=4
do
x=1+rn(sizex/2)*2:y=1+rn(sizey/2)*2
t=bricks(x,y)
loop until(f=0and t=1)or(f=1and t=3)
f=1:r=rn(4)
endif
ax=0:ay=0:e=e-1
if r=0then ay=-1elseif r=1then ay=1elseif r=2then ax=-1else ax=1endif
r=(r+1)%4
t=bricks(x+ax*2,y+ay*2)
loop until t=1or t=6
e=4:x=x+ax:y=y+ay:p=p+1
r=rn(4) ' REM this out for a truly TWISTY maze
map(x,y)=0:x=x+ax:y=y+ay
loop until p=c-1
map(0,1)=0:map(sizex,sizey-1)=0
update()