# generating branching structures without recursion

This topic is 1244 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I thought I had this figured out, but now I'm starting to believe that I was mistaken. I'm working on generating simple branching structures (trees, basically) using a simple command scripting language that supports looping, but not recursion. There is also a stack that I can use the push/pop commands to save the current branch state and load it back to continue working from.

I'm very limited with what I can do with this scripting system, and for some reason I thought I had this figured out, but apparently I don't. Either I can't remember what I thought of, or what I thought of was totally wrong. My original 'aha' solution involved using two nested loops, and I keep thinking I had some clever use of the push/pop orientation stack that let the loops properly generate branches on branches to a defined depth, but I just can't remember or see what I was going to do.

Is it even possible? Am I just going mad?

##### Share on other sites
Your code should probably look something like this:

push_main_task();

while (stack_is_not_empty()) {
}
}


##### Share on other sites

Is it even possible?

Probably.