I am trying a simple example on GHpython (please see attached) and got stuck at the end of the recursive function by its meaning.
I know it is a kind of a way to stop the recursion but cannot understand the meaning behind the code.
I would be so grateful of someone can explain these lines to me in simple English so I can understand it , thank you so much in advance!!
When you first call the recursion() function you need to pass it an initial line and an integer number for gen, say 10. Now, the function will call itself recursively as long as gen is greater than 0 and before that decrement gen by one.
I think line 25 should read return recursion(newline, gen) though.
Find 5 minutes more for that entry level thingy: Added Wind and Gravity. Spot the obvious: Method SHOULD terminate (in real-life) PRIOR max Loops … if you want some sort of rational results (so mastermind proper exit clauses).
Yes, each time the function is called it, decrements gen by 1, then if gen is still greater than 0, it calls itself with the decremented gen value. Otherwise, if gen is equal to 0, it simply stops and None gets returned, since you’re not returning anything else at the end of the function.