U e5d3 @sdZddlTddlmZmZddlmZmZdZ dededZ d d Z d d Z d dZ ddZd&ddZddZddZddZddZddeddfddZefd 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) perf_countersleepgP/7? cCsTt|}tdt|tdt|tdt|tdt|tddS)N$lfltfdrtlflr*/usr/lib64/python3.8/turtledemo/penrose.pykitesrcCsTt|}tdt|tdt|tdt|tdt|tddS)Nr r r rrrrdart%srcCs|dkrFt\}}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|dkrFt\}}ttt|dt|d}}}dt|||f<dSt|}t||dtdt|t dt ||dtdt|t t dt ||dt|t d dS) NrrFrr r6~r ) rrrr r!rr#rrrr"r$r%rrrr"Gs" " r"cCst|t|}t|d|d|tD]T}|\}}}t||t|t|rftdtddntdtddtq*dS)NgY@rblack)r?rr)r.rr) clearrZ shapesizer!Zsetpos setheadingshapeZcolorZstamp)rr&thkr(r)r*rrrdrawZs     r4cCs$tdD]}t||tdqdSNH)ranger#rrr&irrrsunjs  r;cCs$tdD]}t||tdqdSr5)r8r"rr9rrrstaros  r<cCsTtdttdttdtttdttdttddS)Nrdrrr)tracerZ begin_polyrZend_polyZregister_shapeZget_polyrrrrr makeshapests  r?cCs$tttttddS)Nuser)resetZhtZpur?Z resizemoderrrrstarts rB)rrcCsxt|tdiatd|||t|||tdtddtD}tddtD}td||||fdS)NrrcSsg|]}t|r|qSrr!.0r)rrr sztest..cSsg|]}t|s|qSrrErFrrrrHsz"%d kites and %d darts = %d pieces.)gotor0r!r>r4lenprint)rr&funstartposr2ZnkZndrrrtests  rNcCsLttdD]8}t}td||t}||}|dkrtd|qdS)Ni,r)rBr8clockrNr)rLr:abtrrrdemos  rTcCsjtdtdddtttdtttdtddtdddtd d d d t d ddddS)NZlogog333333?rrr-i8gffffff?rzPlease wait...center)z Arial Blackr Zbold)ZalignZfontiXrO)Fu)rMZDone) modeZbgcolorrTr;rr<ZpencolorrIwriterNrrrrmains   rZ__main__N)r)__doc__ZturtleZmathrrtimerrPrrr$rrr#r"r4r;r<r?rBrNrTrZ__name__msgZmainlooprrrrs(