o =?hB @sdZddlTddlmZmZddlmZmZdZ dededZ d d Z d d Z d dZ ddZd&ddZddZddZddZddZddeddfddZefd d!Zd"d#Zed$krgeZed%Sd%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) perf_countersleepgP/7? cCsTt|}tdt|tdt|tdt|tdt|tddS)N$lfltfdrtlflr9/opt/alt/python310/lib64/python3.10/turtledemo/penrose.pykite rcCsTt|}tdt|tdt|tdt|tdt|tddS)Nr r r rrrrdart%rrcCs|dkr#t\}}ttt|dt|d}}}dt|||f<dSt|}tdt||dt|t dt ||dtdt|t t dt ||dtdt|t d t||dtddS) NrrTr r ) posintheadingroundtiledictrr inflatedartrr inflatekitedrnZpxpyhxyrrrrr$1s( "  r$cCs|dkr#t\}}ttt|dt|d}}}dt|||f<dSt|}t||dtdt|t dt ||dtdt|t t dt ||dt|t d dS) NrrFrr r6~r ) rrr r!r"rr$rrrr#r%r&rrrr#Gs" "  r#cCst|t|}t|d|d|tD]*}|\}}}t||t|t|r3tdtddn tdtddtqdS)NgY@rblack)r?rr)r/rr) clearrZ shapesizer"Zsetpos setheadingshapeZcolorZstamp)rr'thkr)r*r+rrrdrawZs     r5cC$tdD] }t||tdqdSNH)ranger$rrr'irrrsunj   r=cCr6r7)r:r#rr;rrrstaror>r?cCsTtdttdttdtttdttdttddS)Nrdrrr)tracerZ begin_polyrZend_polyZregister_shapeZget_polyrrrrr makeshapests   rBcCs$tttttddS)Nuser)resetZhtZpurBZ resizemoderrrrstarts  rE)rrcCsxt|tdiatd|||t|||tdtddtD}tddtD}td||||fdS)NrrcSsg|]}t|r|qSrr".0r*rrr ztest..cSsg|]}t|s|qSrrHrIrrrrKrLz"%d kites and %d darts = %d pieces.)gotor1r"rAr5lenprint)rr'funstartposr3ZnkZndrrrtests  rRcCsLttdD]}t}td||t}||}|dkr#td|qdS)Ni,r)rEr:clockrRr)rPr<abtrrrdemos   rXcCsjtdtdddtttdtttdtddtdddtd d d d t d ddddS)NZlogog333333?rrr.i8gffffff?rzPlease wait...center)z Arial Blackr Zbold)ZalignZfontiXrS)Fu)rQZDone) modeZbgcolorrXr=rr?ZpencolorrMwriterRrrrrmains   r^__main__N)r)__doc__ZturtleZmathrrtimerrTrrr%rrr$r#r5r=r?rBrErRrXr^__name__msgZmainlooprrrrs,