Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
Kerm, that's definitely recursive division, not DFS. Mine uses a strange algorithm though it can be thought of as a mathematical model of recursive division. I just finished my math final so I'm working on a program the uses Eller's algorithm and another that uses Kruskal's algorithm.
It's definitely depth-first. I should know, I've spent a semester on Honors Analysis of Algorithms, one of my PhD qualifier exams, and an algorithm that explores a tree depth-first rather than breadth-first is a depth-first search algorithm. Just because it happens to be a pre-order DFS doesn't change that it's a DFS. Razz I could just as easily draw the edges inorder or postorder. In this case, the DFS tree has cells on its vertices, and smaller cells are deepest into the tree.

@Weregoose, nice job.
Algorithms definition vs. Mazing definition. Meh. I'm working on one now that creates a maze one row at a time and doesn't store the while maze in memory. Though I'm pretty sure it won't be faster than the other I posted.
Pseudoprogrammer wrote:
Algorithms definition vs. Mazing definition. Meh. I'm working on one now that creates a maze one row at a time and doesn't store the while maze in memory. Though I'm pretty sure it won't be faster than the other I posted.
Ah, good luck on that. I doubt that Maze generators re-invented the definition of a depth-first search, though. Wink
On most Mazing websites DFS is synonymous with a recursive backtracker.
Weighing in at 220 bytes, using very little memory (it doesn't even store any of the maze in memory, the algorithm only has knowledge of the current row!), though it takes about 3 minutes per render


Code:
ZStandard
84 -> Xmax
52 -> Ymax
For(A,-10,84,2
VerticalA
HorizontalA
End
seq(B,B,1,47 -> L1
A -> C
For(A,1,61,2
For(B,1,46
If (randInt(0,1) or A=61) and L1(B)=/=L1(B+1
Then
(L1)(L1=/=L1(B+1 -> L1
L1(B)not(L1)+L1 -> L1
Pxl-Off(A,2B
End
End
For(B,1,47
If A=/=61 and (randInt(0,1) or 1=sum(L1=L1(B
Then
Pxl-Off(A+1,2B-1
Else
C -> L1(B
C+1 -> C
End
End
End
Not bad, not bad at all. I see a few tiny optimizations, but nothing major. Also, please use [code] tags around your code.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 4 of 4
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement