3 ^S @sdZddlTddlmZmZddlmZmZd*Zd ed ed Z d d Z ddZ ddZ ddZ d+ddZddZddZddZddZdded,d fd d!Zefd"d#Zd$d%Zed&kreZed'S)-a 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 ------------------------------------------- )*)cospi)clocksleepg?g@ cCsTt|}tdt|tdt|tdt|tdt|tddS)N$l)fltfdrt)lflr*/usr/lib64/python3.6/turtledemo/penrose.pykitesrcCsTt|}tdt|tdt|tdt|tdt|tddS)Nr r)rrrr)rrrrrdart%srcCs|dkrFt\}}ttt|dt|d}}}dt|||f<dSt|}tdt||dt|t dt ||dtdt|t t dt ||dtdt|t d t||dtddS) Nrr Tr rr) posintheadingroundtiledictrr inflatedartrr inflatekited)rnpxpyhxyrrrrr"1s( " r"cCs|dkrFt\}}ttt|dt|d}}}dt|||f<dSt|}t||dtdt|t dt ||dtdt|t t dt ||dt|t d dS) Nrr Frr r6~r) rrrrr rr"rrrr!r#)rr$r%r&r'r(r)rrrrr!Gs" " r!cCst|t|}t|d|d|x\tD]T}|\}}}t||t|t|rhtdtddntdtddtq,WdS) NgY@rblackr?r)rr-r)r-rr) clearrZ shapesizer Zsetpos setheadingshapeZcolorZstamp)rr$thkr'r(r)rrrdrawZs      r3cCs(x"tdD]}t||tdq WdS)NrH)ranger"r)rr$irrrsunjs r7cCs(x"tdD]}t||tdq WdS)Nrr4)r5r!r)rr$r6rrrstaros r8cCsTtdttdttdtttdttdttddS)Nrdrrr)tracerZ begin_polyrZend_polyZregister_shapeZget_polyrrrrr makeshapests  r;cCs$tttttddS)Nuser)resetZhtZpur;Z resizemoderrrrstarts r>c Cst|tdiat}td|||t}t|||tdt}tddtD}tddtD} td|| || fdS)NrrcSsg|]}t|r|qSr)r ).0r(rrr sztest..cSsg|]}t|s|qSr)r )rAr(rrrrBsz"%d kites and %d darts = %d pieces.)gotor/r rr:r3lenprint) rr$funstartposr1abcZnkZndrrrtests  rKcCsPtxDtdD]8}t}td||t}||}|dkrtd|qWdS)Ni,r )r>r5rrKr)rFr6rHrItrrrdemos rNcCsjtdtdddtttdtttdtddtdddtd d ddt dddddS)NZlogog333333?rr r,r?gffffff?rzPlease wait...center Arial Blackr bold)ZalignZfontiXrLFu)rGZDonei8)rPr rQ)rRrS) modeZbgcolorrNr7rr8ZpencolorrCwriterKrrrrmains    rV__main__Ngw@gP/7?gP/7?)r )rr)__doc__ZturtleZmathrrZtimerrrr#rrr"r!r3r7r8r;r>rKrNrV__name__msgZmainlooprrrrs(