Depending on the values of initialLength
and multiplier
, it is very possible that your function will never be exactly 1. You check for this right here:
if initialLength == 1 or newLength ==1:
up()
If it never reaches exactly one, the turtle will never stop drawing.
Try changing it to:
if initialLength <= 1 or newLength <=1:
up()
Honestly, you could just do:
if initialLength <= 1:
up()
Because initialLength
and newLength
are the essentially the same variable, they only differ by one factor of multiplier
(one recursion depth).