資源簡介
代碼片段和文件信息
#!/usr/bin/env?python3
“““???????xturtle-example-suite:
??????????xtx_kites_and_darts.py
Constructs?two?aperiodic?penrose-tilings
consisting?of?kites?and?darts?by?the?method
of?inflation?in?six?steps.
Starting?points?are?the?patterns?“sun“
consisting?of?five?kites?and?“star“
consisting?of?five?darts.
For?more?information?see:
?http://en.wikipedia.org/wiki/Penrose_tiling
?-------------------------------------------
“““
from?turtle?import?*
from?math?import?cos?pi
from?time?import?perf_counter?as?clock?sleep
f?=?(5**0.5-1)/2.0???#?(sqrt(5)-1)/2?--?golden?ratio
d?=?2?*?cos(3*pi/10)
def?kite(l):
????fl?=?f?*?l
????lt(36)
????fd(l)
????rt(108)
????fd(fl)
????rt(36)
????fd(fl)
????rt(108)
????fd(l)
????rt(144)
def?dart(l):
????fl?=?f?*?l
????lt(36)
????fd(l)
????rt(144)
????fd(fl)
????lt(36)
????fd(fl)
????rt(144)
????fd(l)
????rt(144)
def?inflatekite(l?n):
????if?n?==?0:
????????px?py?=?pos()
????????h?x?y?=?int(heading())?
- 上一篇:設置進程依附到某個cpu運行
- 下一篇:python五子棋
評論
共有 條評論