所以,我正在尝试制作一个在海龟中制作螺旋的功能。它似乎工作正常,除了该函数在我希望它下降到一个像素时停止绘制时会继续绘制和绘制。任何帮助,将不胜感激!
def spiral( initialLength, angle, multiplier ):
"""uses the csturtle drawing functions to return a spiral that has its first segment of length initialLength and subsequent segments form angles of angle degrees. The multiplier indicate how each segment changes in size from the previous one.
input: two integers, initialLength and angle, and a float, multiplier
"""
newLength = initialLength * multiplier
if initialLength == 1 or newLength ==1:
up()
else:
forward(initialLength)
right(angle)
newLength = initialLength * multiplier
if newLength == 0:
up()
return spiral(newLength,angle, multiplier)