1. Please post code fragments that are hard to understand so that I can explain those fragments. SourceCoder 2.5 should be able to help you.
2. That's what recursion is. Generally, recursion consists of two major components: (1) one or more subroutines or methods that call themselves or each other, forming deeper and deeper call trees, and (2) some kind of escape condition than makes the call tree bottom out and start returning upward.
For #2:
I couldn't resist trying to show you a place where you didn't follow your guide. I know that doesn't count, but trust me, if you ever do break your own rules, I will laugh. Laughing
c.sprinkle wrote:
For #2:
I couldn't resist trying to show you a place where you didn't follow your guide. I know that doesn't count, but trust me, if you ever do break your own rules, I will laugh. 0x5
I don't understand your statement at all, nor do I appreciate people who derive pleasure from others' pain or displeasure. Please explain yourself.
Sorry. I just think it's funny when people tell you to do something and then don't follow it themselves. But you didn't.

Also, for an algorithm:

Would this work for recursive-division:
Walls around graphscreen. Then-

Code:

randInt(1,63->A
randInt(1,95->B
randInt(1,95->C
Line(0, A, B, A
Line(B, A, C, A
Line(C, A, 96, A
Then repeat for the vertical wall
Then become recursively smaller
What is that supposed to do? I tried it, and it fills half of the graphscreen with random lines. Confused
HAHAHAHAHAHAHAHAHAHAHAHAHAHA!!!
That's what it's supposed to do.
(I think)
Post a screenshot.
Smile
c.sprinkle wrote:
Sorry. I just think it's funny when people tell you to do something and then don't follow it themselves. But you didn't.
I don't think it's funny, I think that they're human, and made a mistake like all humans. I would be happy to point it out to them nicely, but I wouldn't be happy mocking them for their error unless they were acting particularly arrogant and claiming they never make mistakes. I make no such claim, so I'd be happy to know about any mistakes I make, but should I ever happen to make such a mistake, I'd expect the same respectful treatment I would give you.

c.sprinkle wrote:
Also, for an algorithm:

Would this work for recursive-division:
Walls around graphscreen. Then-

Code:

randInt(1,63->A
randInt(1,95->B
randInt(1,95->C
Line(0, A, B, A
Line(B, A, C, A
Line(C, A, 96, A
Then repeat for the vertical wall
Then become recursively smaller
Which algorithm are you trying to use? One of the ones from the Wikipedia page?
c.sprinkle wrote:
HAHAHAHAHAHAHAHAHAHAHAHAHAHA!!!
That's what it's supposed to do.
(I think)
Post a screenshot.
Smile


I think it can be optimized by using Horizontal instead of Line().
Let's leave it at this, Kerm:
I am sorry for making an annoying comment.

The algorithm is for recursive division.
It doesn't recursively divide, it outputs random lines. Recursive division is like this

Code:
While 1
X/2->X
Disp X
End


This recursively divides X by 2 and displays X.
Souvik, I'm trying to recursively divide the screen. Read the thread.
c.sprinkle, Souvik was correctly pointing out that you're not doing any recursion. I'm sure he read the thread already. Let's go about this more systematically; we'll start with what Wikipedia said:

Quote:
Mazes can be created with recursive division, an algorithm which works as follows: Begin with the maze's space with no walls. Call this a chamber. Divide the chamber with a randomly positioned wall (or multiple walls) where each wall contains a randomly positioned passage opening within it. Then recursively repeat the process on the subchambers until all chambers are minimum sized. This method results in mazes with long straight walls crossing their space, making it easier to see which areas to avoid.

For example, in a rectangular maze, build at random points two walls that are perpendicular to each other. These two walls divide the large chamber into four smaller chambers separated by four walls. Choose three of the four walls at random, and open a one cell-wide hole at a random point in each of the three. Continue in this manner recursively, until every chamber has a width of one cell in either of the two directions.


Let's say we want our walls to be 5 pixels apart, for the sake of sanity. So, here are the steps:
(1) Draw the outer walls
(2) Call SubCall(X1=0,X2=95,Y1=0,Y2=60)

SubCall(X1,X2,Y1,Y2)
(1) Pick a random X location A between X1 and X2; A is a mult of 5
(2) Pick a random Y location B between Y1 and Y2; B is a mult of 5
(3) Draw Line(X1,B,X2,B)
(4) Draw Line(A,Y1,A,Y2)
(5) Pick a random number Q=1, 2, 3, or 4. This will be the wall you don't cut
(6) Cut a random 5-pixel gap on three of the walls, omitting wall Q
(7a) If A-X1>5 and B-Y1>5, call SubCall(X1,A,Y1,B)
(7b) If A-X1>5 and Y2-B>5, call SubCall(X1,A,B,Y2)
(7c) If X2-A>5 and B-Y1>5, call SubCall(A,X2,Y1,B)
(7d) If X2-A>5 and Y2-B>5, call SubCall(A,X2,B,Y2)
(8) Return
What about this:

Code:

DelVar PDelVar R
63->Q
95->S
Lbl 00
randInt(P,Q->A
Line(R,A,S,A
randInt(R+1,S-1->B
Pxl-Off(B,A
B-1->T


randInt(T,S->C
Line(C,A,C,Q
randInt(A+1,Q-1->D
Pxl-Off(C,D

D-1->P


Goto 00
That's an iterative algorithm, not a recursive algorithm. Iterative algorithms run in a loop; recursive algorithms call themselves. The code you presented there seems to have almost nothing to do with the extremely detailed steps I just presented...
I was writing it at the same time and thus not paying attention to your posts. Sorry.
Never mind about that code. It doesn't work.
c.sprinkle wrote:
I was writing it at the same time and thus not paying attention to your posts. Sorry.
No apology necessary, I just wanted to make sure that your code was not an attempt to translate my steps.
Alright, I'm still working on it. I'll have something soon.


The file has been uploaded at last!
I look forward to hearing your comments, reviews, and suggestions.
Please try this- I put a lot of work into its development.
c.sprinkle wrote:
Alright, I'm still working on it. I'll have something soon.


The file has been uploaded at last!
I look forward to hearing your comments, reviews, and suggestions.
Please try this- I put a lot of work into its development.
Very Happy Smile Very Happy Smile Very Happy Smile Very Happy Smile Very Happy Smile Very Happy Smile Very Happy Smile Very Happy Smile Very Happy Smile

I also fixed a nasty bug. PLEASE try this!

Very Happy Smile Very Happy Smile Very Happy Smile Very Happy Smile Very Happy Smile Very Happy Smile Very Happy Smile Very Happy Smile Very Happy Smile
Other than the eye-shatteringly massive wall of smileys, I tried this out when I was accepting it to the Archives and didn't find any big problems. Did you try writing the generator from my outline above yet?
I can edit the smileys out if you want, and yes, I am working on the generator. Thanks for the help.
The smileys are gone.
c.sprinkle wrote:
I can edit the smileys out if you want, and yes, I am working on the generator. Thanks for the help.
Do you need any assistance? Are you implementing it recursively as I suggested? Are you making progress or are you stuck?
  
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 2 of 4
» All times are UTC - 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