
    ;e	                         	 d dl mZmZmZmZ dZ G d de          Z G d de          Z	d Z
edk    r e
              e             d	S d	S )
    )ShapeTurtlemainloopVec2D   c                        e Zd Zd Zd Zd ZdS )GravSysc                 0    g | _         d| _        d| _        d S )Nr   g{Gz?)planetstdt)selfs    1/usr/lib/python3.11/turtledemo/planet_and_moon.py__init__zGravSys.__init__   s        c                 B    | j         D ]}|                                 d S )N)r   init)r   ps     r   r   zGravSys.init   s,     	 	AFFHHHH	 	r   c                     t          d          D ]5}| xj        | j        z  c_        | j        D ]}|                                 6d S )Ni'  )ranger   r   r   step)r   ir   s      r   startzGravSys.start    sX    u 	 	AFFdgFF\  	 	r   N)__name__
__module____qualname__r   r   r    r   r   r	   r	      sA                r   r	   c                   &    e Zd Zd Zd Zd Zd ZdS )Starc                 4   t          j        | |           |                                  || _        |                     |           || _        |j                            |            || _        | 	                    d           | 
                                 d S )N)shapeuser)r   r   penupmsetposvr   appendgravSys
resizemodependown)r   r$   xr&   r(   r!   s         r   r   zStar.__init__'   s    E****

At$$$r   c                     | j         j        }|                                 | _        | j        d|z  | j        z  z   | _        d S )N      ?)r(   r   accar&   r   r   s     r   r   z	Star.init1   s6    \_#b&-'r   c                     t          dd          }| j        j        D ]Y}|| k    rQ|                                |                                 z
  }|t          |j        z  t          |          dz  z  |z  z  }Z|S )Nr      )Vecr(   r   posGr$   abs)r   r/   planetr&   s       r   r.   zStar.acc5   sp    !HHl* 	. 	.F~~JJLL+ajQ*A--r   c                    | j         j        }|                     |                                 || j        z  z              | j         j                            |           dk    r8|                     |                     | j         j        d                              | 	                                | _
        | j        || j
        z  z   | _        d S )Nr   )r(   r   r%   r4   r&   r   index
setheadingtowardsr.   r/   r0   s     r   r   z	Star.step<   s    \_DHHJJDF*+++<%%d++q00OODLL)=a)@AABBB"TV)#r   N)r   r   r   r   r   r.   r   r   r   r   r   r   &   sP        	 	 	( ( (  $ $ $ $ $r   r   c                  F   t                      } |                                  |                                                     dd           |                                  |                                  |                     d           |                     d           |                                  | 	                    dd           | 
                                 |                                 }|                                  | 	                    dd           | 
                                 |                                 }t          d          }|                    |d           |                    |d           |                                                     d|           |                                                     d	d           t                      }t!          d
t#          dd          t#          dd          |d          }|                    d           |                    d           |                                 t!          dt#          dd          t#          dd          |d          }|                    d           |                    d           t!          d	t#          dd          t#          dd          |d          }|                    d           |                    d           |                                 |                                 dS )Nr      Z      compoundorangebluer7      i@B g      circleyellowg?i0        greeng?   i'  r-   zDone!)r   reset	getscreentracerhtpufdlt
begin_polyrD   end_polyget_polyr   addcomponentregister_shaper	   r   r3   color	shapesizepencolorr   r   )sm1m2planetshapegssunearthmoons           r   mainra   F   sh   AGGIIIKKMM1DDFFFDDFFFDDGGGDDHHHLLNNNHHQJJLLL	
BLLNNNHHQsOOOJJLLL	
B
##KR)))R'''KKMM  ;777KKMM1 
B
wAa#a++r8
<
<CIIhMM#FFHHHC

C#JJH==E	NN7	OOC3s1::s1Szz2x88DMM&NN3GGIIIHHJJJ7r   __main__N)turtler   r   r   r   r3   r5   objectr	   r   ra   r   r   r   r   <module>re      s   $ 9 8 8 8 8 8 8 8 8 8 8 8    f   $ $ $ $ $6 $ $ $@% % %N zDFFFHJJJJJ r   