Qbasicnews.com

Full Version: Recursion
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Excuse the n00b question, but is FB able to do recursion deeper than qb?
Sure. By default the stack size is 1 Mb. In QB it was 64 Kb. So you do the math Wink
Somewhere V1ctor wrote that the default stack size is 1Mb, so probably you can have in FB a lot more recursion than in QB. Just try...
i'll write a dumb test later(just a proc that does some wasteful calculations, displays the current depth, till it eventually screws up with an error message)
Just try this:

Code:
Declare Sub killStack (recursionDepth%)

killStack 0

Sub KillStack (recursionDepth%)
   Print recursionDepth%
   KillStack (recursionDepth% + 1)
End Sub
Quote:Just try this:

Code:
Declare Sub killStack (recursionDepth%)

killStack 0

Sub KillStack (recursionDepth%)
   Print recursionDepth%
   KillStack (recursionDepth% + 1)
End Sub
I had 37381.
With the compiler switch -t I switched the stack to 10mb and got 373985.
I think it's far enough :o Big Grin
Recursive floodfill, anyone? Big Grin
Is there any other way to do flood fill? Besides maybe a modified a* algorithm.....
i made an a* once *thinks back to challenge*

yeah i once made a flood fill i think.... i dont remember though

edit: i shoul dprobly describe it =P


it goes around (up until end, right until end, etc) and in a dead end backtracks untill it can move.
Pages: 1 2