Here is some great, relatively easy code to manipulate to your needs for creating a simple maze with a start and exit point. It's completely based on a simple function in DBPro by spooky. I just adapted it for fun into AppGameKit
I hope it's useful to someone!
rem
rem AGK Application
rem
rem Landscape App
SetVirtualResolution(640,480)
setViewOffset(-20,-20)
setPrintSize(16)
size = 35
generateMaze(size,0,0,1)
rem A baxslash Did It (with a lot of help from spooky)!
do
print("Click to regenerate maze")
press = getPointerPressed()
generateMaze(size,1,6,0)
Sync()
loop
function generateMaze(width,draw,w,generate)
` s=size of maze (2 or more)
` xs=startx (MUST be even)
` ys=starty (MUST be even)
s=width
xs=2
ys=2
t=s*2+1
if generate>0
dim d[4,2] as integer : d[1,1]=1 : d[2,2]=1 : d[3,1]=-1 : d[4,2]=-1
global dim maze[t,t] as integer
x=xs : y=ys : z=0 : zm=0
for f=1 to t
maze[f,1]=1
maze[f,t]=1
maze[1,f]=1
maze[t,f]=1
next f
rem generate maze
repeat
k=1
for f=1 to 3
r1=random(0,3)+1
r2=random(0,3)+1
pp1=d[r1,1]
pp2=d[r1,2]
d[r1,1]=d[r2,1]
d[r1,2]=d[r2,2]
d[r2,1]=pp1
d[r2,2]=pp2
next f
for f=1 to 4
dx=d[f,1] : dy=d[f,2]
if maze[x+dx,y+dy]=0
if maze[(2*dx)+x,(2*dy)+y]=0
maze[x,y]=2 : maze[x+dx,y+dy]=2 : x=x+(2*dx) : y=y+(2*dy) : inc z
if z > zm
zm=z
global x1=x
global y1=y
endif
k=0
exit
endif
endif
next f
if k=1
for f=1 to 4
dx=d[f,1]
dy=d[f,2]
if maze[x+dx,y+dy]=2
maze[x,y]=3
maze[x+dx,y+dy]=3
x=x+(2*dx)
y=y+(2*dy)
dec z
k=0
exit
endif
next f
endif
until k=1
maze[x,y]=3
endif
rem draw maze
if draw>0
spr = createSprite(0)
setSpriteSize(spr,w,w)
rem draw maze
for f=1 to t
for g=1 to t
c=maze[f,g]
if (f=x1 and g=y1) or (f=xs and g=ys) or (c < 2)
if c < 2
setSpriteColor(spr,0,0,255,255)
else
setSpriteColor(spr,0,255,0,255)
endif
setSpritePosition(spr,(g-1)*w,(f-1)*w)
drawSprite(spr)
endif
next g
next f
deleteSprite(spr)
endif
endfunction
EDIT: Original post -
http://forum.thegamecreators.com/?m=forum_view&t=87535&b=7
this.mess = abs(sin(times#))