This way, I see the result at the very end of the recursion if you know what I mean, there's no animation, only one result. I understand that this is so because draw() function calls the drrr() function which calls itself, which then calls itself etc. and only when the recursion is over, the draw function finaly makes a loop and updates itself and draws the picture.
I'm looking for a way of drawing the steps of the recursion separately, each level of branches in a different frame and I have no idea how to even start programing something like that.
The reason I'm asking you how to do this is because I'd like to draw something like the lines in the first of two codes I posted above in order to simulate the growth of mycelium. My idea is to draw a line which will then (at the moment I will define as I want) split into few branches which would then act in the same way as other branches and this deffinitely has something to do with recursion and I'd like to learn more about thinking in that way.
Why is this in Processing Implementations? Looks like Java. Are you using Processing.js? Just in case, I move the topic.
And beside the smart idea of Chrisir of storing all the states in the recursion steps, there is no simple way to do that with recursion, which by definition must achieve all its processing before spitting out a result. And you get drawing only after draw() exits. Recursion and progressive drawing are rarely friend...
Hmm, did I put this thread in Processing Implementations? I'm sorry for that, my idea was to put it in the Programming Questions, I probably misread the names.
Luckily, I found out a way of avoiding the usage of recursion. As I said, I wanted to simulate the growth of mycelium. I wanted a single curve to be split at a given moment, in this case the mouse click. When the mouse is clicked, two more objects are added to the ArrayList. Each level of mycelium is curvier than the previous one.