Ë
‚Ö¦iy ã ón — d Z ddlmZmZ ddlmZ d„ Zd„ Zd„ Z e
dk( r e « Z ee« e« yy) a— turtle-example-suite:
tdemo_tree.py
Displays a 'breadth-first-tree' - in contrast
to the classical Logo tree drawing programs,
which use a depth-first-algorithm.
Uses:
(1) a tree-generator, where the drawing is
quasi the side-effect, whereas the generator
always yields None.
(2) Turtle-cloning: At each branching point
the current pen is cloned. So in the end
there are 1024 turtles.
é )ÚTurtleÚmainloop)Úperf_counterc # ó( K — |dkD r‰g }| D ]g }|j |« |j « }|j |« |j |« |j |« |j |« Œi t |||z ||« D ] }d–— Œ yyw)z¤ plist is list of pens
l is length of branch
a is half of the angle between 2 branches
f is factor by which branch is shortened
from level to level.é N)ÚforwardÚcloneÚleftÚrightÚappendÚtree)ÚplistÚlÚaÚfÚlstÚpÚqÚxs ú(/usr/lib64/python3.12/turtledemo/tree.pyr
r
s… è ø€ ð ˆ1‚u؈ۈAØ
�I‰I�aŒLØ—‘“ ˆAØ
�F‰F�1ŒIØ
�G‰G�AŒJØ�J‰J�qŒMØ�J‰J�q�Mð
ô �c˜1˜Q™3 1Ö%ˆAØ‹Jñ &ð
ùs ‚BBc ól — t « } | j d « | j « | j d« | j « j dd« | j
d« | j « | j d« | j « t | gddd« }|D ] }Œ y )Nr é éZ i.ÿÿÿéÈ éA gffffffä?)r Ú
setundobufferÚ
hideturtleÚspeedÚ getscreenÚtracerr
Úpenupr Úpendownr
)r Útr s r Úmaketreer$ ' s† € Ü‹€A؇O�O�DÔØ‡L�L„N؇G�GˆA„J؇K�KƒM×ј˜AÔØ‡F�Fˆ2„J؇G�G„I؇I�Iˆd„O؇I�I„K܈aˆS�#�r˜6Ó"€AÛ
ˆØñ ó c óN — t « } t « t « }d|| z
z S )Nzdone: %.2f sec.)Úclockr$ )r Úbs r Úmainr) 5 s$ € ܃g€AÜ„J܃g€AØ !¡Ñ$Ð$r% Ú__main__N)
Ú__doc__Úturtler r Útimer r' r
r$ r) Ú__name__ÚmsgÚprint© r% r Ú