我是靠谱客的博主 满意面包,最近开发中收集的这篇文章主要介绍科勒曲线(课本),觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

import turtle
import time
def koch(size,n):
    if n==0:
        turtle.fd(size)
    else:
        for angle in[0,60,-120,60]:
            turtle.left(angle)
            koch(size/3,n-1)
def main():
    turtle.setup(600,600)
    turtle.speed(2)
    turtle.penup()
    turtle.goto(-200,100)
    turtle.pendown()
    turtle.pensize(2)
    level=5
    koch(400,level)
    turtle.right(120)
    koch(400,level)
    turtle.right(120)
    koch(400,level)
    turtle.hideturtle()
main()
t=time.clock()
print("Time Used:{}".format(time.clock()-t))

  

Time Used:8.444444444444446e-06
>>> 


 

转载于:https://www.cnblogs.com/zj123-/p/6746793.html

最后

以上就是满意面包为你收集整理的科勒曲线(课本)的全部内容,希望文章能够帮你解决科勒曲线(课本)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(39)

评论列表共有 0 条评论

立即
投稿
返回
顶部