I'm writing a maze generator, but it's not what i expected...
Can anyone help ???
here's what i've done...
(I'm using an array for now, but final version will use a memory buffer for ops
Code: Select all
***** SCRAP ****
SEE BELOW :P

Code: Select all
***** SCRAP ****
SEE BELOW :P

Code: Select all
;Maze Generator
;By Num3 - 2003
;Part of Wizards Dungeon Game
x = Val(InputRequester("X", "X Size:", "32"))
y = Val(InputRequester("Y", "Y Size:", "32"))
total = (x * y )
Dim maze(x, y)
xx = Int(Random(x)/2)*2
yy = Int(Random(y)/2)*2
For a = 1 To total * 2
rnd = Random(3)
Select rnd
Case 0 ;right
If xx + 2 < x And maze(xx + 2, yy)=0 And maze(xx , yy)=0
maze(xx + 2, yy)=1
maze(xx + 1, yy)=1
xx + 2
Else
xx = Int(Random(x)/2)*2
yy = Int(Random(y)/2)*2
EndIf
Case 1 ;left
If xx - 2 > 0 And maze(xx - 2, yy)=0 And maze(xx , yy)=0
maze(xx - 2, yy)=1
maze(xx - 1, yy)=1
xx - 2
Else
xx = Int(Random(x)/2)*2
yy = Int(Random(y)/2)*2
EndIf
Case 2 ;up
If yy + 2 < y And maze(xx, yy + 2)=0 And maze(xx , yy)=0
maze(xx , yy + 2)=1
maze(xx , yy + 1)=1
yy + 2
Else
xx = Int(Random(x)/2)*2
yy = Int(Random(y)/2)*2
EndIf
Case 3 ;down
If yy - 2 > 0 And maze(xx, yy - 2)=0 And maze(xx , yy)=0
maze(xx , yy - 2)=1
maze(xx , yy - 1)=1
yy - 2
Else
xx = Int(Random(x)/2)*2
yy = Int(Random(y)/2)*2
EndIf
EndSelect
Next
;Draw the container
For a = 1 To x
maze( a, 1)=1
maze( a, y - 1)=1
Next
For a = 1 To y
maze(1, a)=1
maze(x - 1 , a)=1
Next
CreateImage(0, x, y)
StartDrawing(ImageOutput())
For a = 1 To x
For b = 1 To y
If maze(a, b)=1
Plot(a, b , RGB(255, 255, 255))
EndIf
Next
Next
StopDrawing()
SaveImage(0, "d:\temp\maze00.bmp")