algorithmic modeling for Rhino
Tags:
Hi Zumii
I am not exactly sure what this script should do. A recursive function, generally, does not need a for loop inside. You should try to think of a way to remove that for loop. Also, have a counter of generations, and each time you call your function again, increase it.
If you need any more help, please let me know.
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
Giulio is totally right, a recursive function or algorithm calls itself to create the repetitive behaviour in the task they do. Try this and see if you understand the concept. Iteration is the other way to go and usually it uses loops in order to create repetition.
a = 0
def recursive_add(variable):
if variable >10:
return variable
else:
variable++
print variable
recursive_add(variable)
recursive_add(a)
Cheers.
Ángel.
I'm not sure Python supports the ++ style of incrementing a variable. If not this should work:
variable += 1
Hehehe!,
Yeah, you're right. Sorry, I've been coding in Processing last month :P It seams that I contaminated my python knowledge a bit :P
Hehe, been there myself :)
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by