So, I decided to beat this result and made my version of "Largest Maze on the Internet". It is 5555x5555 size and can be downloaded here: https://www.dropbox.com/s/nlapkyhm8j48c ... 5x5555.png
Program to make it is my "A-Maze v3.0":
Code: Select all
'A-maze v3.0
'labyrinth generator
'made in "smart BASIC"
'(c)Mr.Kibernetik, 2014
'settings
maze.width=201
maze.height=201
maze.fastperc=90 'percent of filling when implement fast fill
drawtext=1
maze.wsize=2
scene.width=(maze.width-0.5)*maze.wsize
scene.height=(maze.height-0.5)*maze.wsize
draw size maze.wsize/2
scene
maze
def scene
option screenlock off
graphics
graphics clear
option sprite pos central
sprite 0 begin width,height
'draw labyrinth silhouette
graphics clear 0,0,1
if .drawtext then
draw color 0,0,0
if maze.height>=200 then
draw font size height/10
t$="made by"
tx=(width-text_width(t$))/2
ty=height/3
draw text t$ at tx,ty
t$="Mr.Kibernetik"
tx=(width-text_width(t$))/2
ty=height/2
draw text t$ at tx,ty
else
draw font size height
t$="A"
tx=(width-text_width(t$))/2
ty=-height/10
draw text t$ at tx,ty
end if
end if
sprite end
maxx=screen_width()
maxy=screen_height()
ss=min(maxx/width,maxy/height)
sprite 0 at maxx/2,maxy/2 scale ss
sprite 0 show
end def
def maze
width1=width-1
height1=height-1
size=width*height
dim pt(width,height),grp(size+1)
ss=screen_scale()
sprite 0 begin
refresh off
draw color 0,0,0
draw linecap round
for x=0 to width1
xs=x*wsize*ss
for y=0 to height1
ys=y*wsize*ss
get pixel xs,ys color r,g,b
draw pixel xs,ys color 1,1,1
if r+g+b=0 then continue y
cnt+=1
pt(x,y)=cnt
grp(cnt)=cnt
next y
refresh
next x
randomize
graphics clear 1,1,1
for x=0 to width1
for y=0 to height1
if pt(x,y)=0 then continue y
dn=0 ! d1=0 ! d2=0 ! d3=0 ! d4=0
if (y>0 and pt(x,y-1)=0) or y=0 then
dn+=1 ! d3=1
end if
if (y<height1 and pt(x,y+1)=0) or y=height1 then
dn+=1 ! d1=1
end if
if (x>0 and pt(x-1,y)=0) or x=0 then
dn+=1 ! d2=1
end if
if (x<width1 and pt(x+1,y)=0) or x=width1 then
dn+=1 ! d4=1
end if
if y=0 and d1 then
dn-=1 ! d1=0
end if
if y=height1 and d3 then
dn-=1 ! d3=0
end if
if x=0 and d4 then
dn-=1 ! d4=0
end if
if x=width1 and d2 then
dn-=1 ! d2=0
end if
if dn=0 then continue y
if dn=4 then
cnt-=1
pt(x,y)=0
continue y
end if
if dn=3 then
if d1=0 or d3=0 then
d2=0 ! d4=0 ! goto cont
end if
d1=0 ! d3=0 ! goto cont
end if
if dn=2 then
if d1 and d3 then
d1=0 ! d3=0 ! d2=1 ! d4=1 ! goto cont
end if
if d2 and d4 then
d1=1 ! d3=1 ! d2=0 ! d4=0 ! goto cont
end if
goto cont
end if
if d1 or d3 then
d1=0 ! d2=1 ! d3=0 ! d4=1 ! goto cont
end if
if d2 or d4 then
d1=1 ! d2=0 ! d3=1 ! d4=0 ! goto cont
end if
cont:
x1=x ! y1=y ! n1=getgrp(pt(x1,y1))
if n1=0 then continue y
if d1 then
x2=x ! y2=y-1 ! n2=getgrp(pt(x2,y2))
if n2=0 or n1=n2 then continue y
wall(x1,y1,x2,y2,n1,n2)
end if
if d2 then
x2=x+1 ! y2=y ! n1=getgrp(pt(x1,y1)) ! n2=getgrp(pt(x2,y2))
if n2=0 or n1=n2 then continue y
wall(x1,y1,x2,y2,n1,n2)
end if
if d3 then
x2=x ! y2=y+1 ! n1=getgrp(pt(x1,y1)) ! n2=getgrp(pt(x2,y2))
if n2=0 or n1=n2 then continue y
wall(x1,y1,x2,y2,n1,n2)
end if
if d4 then
x2=x-1 ! y2=y ! n1=getgrp(pt(x1,y1)) ! n2=getgrp(pt(x2,y2))
if n2=0 or n1=n2 then continue y
wall(x1,y1,x2,y2,n1,n2)
end if
next y
refresh
next x
loop:
if wall.perc>=fastperc then fastfin
x1=rnd(width-2)+1
y1=rnd(height-2)+1
n1=getgrp(pt(x1,y1))
if n1=0 then loop
on rnd(4)+1 gosub 1,2,3,4
n2=getgrp(pt(x2,y2))
if n1=n2 or n2=0 then loop
wall(x1,y1,x2,y2,n1,n2)
goto loop
1 x2=x1 ! y2=y1-1 ! return
2 x2=x1+1 ! y2=y1 ! return
3 x2=x1 ! y2=y1+1 ! return
4 x2=x1-1 ! y2=y1 ! return
fastfin:
width2=width-2
height2=height-2
for x1=1 to width2
for y1=1 to height2
n1=getgrp(pt(x1,y1))
if n1=0 then continue y1
for i=1 to 4
on i gosub 1,2,3,4
n2=getgrp(pt(x2,y2))
if n1=n2 or n2=0 then continue
wall(x1,y1,x2,y2,n1,n2)
n1=getgrp(pt(x1,y1))
if n1=0 then continue y1
next i
next y1
refresh
next x1
refresh on
sprite end
f$="laby "&maze.width1&"x"&maze.height1&".png"
sprite 0 save f$
notes set ,,,,,,,,,"wa5"
notes play
pause notes_length()
end
end def
def wall(x1,y1,x2,y2,n1,n2)
px1=x1*maze.wsize
py1=y1*maze.wsize
px2=x2*maze.wsize
py2=y2*maze.wsize
draw line px1,py1 to px2,py2
maze.grp(n2)=n1
maze.pt(x2,y2)=n1
cnt+=1
perc=int(100*cnt/maze.cnt)
if cnt%1000=0 then refresh
end def
def getgrp(n)
no=n
loop:g=maze.grp(n)
if g=n then
if n<>no then maze.grp(no)=n
return n
end if
n=g
goto loop
end def