404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.147.2.189: ~ $
�
��^c@s5dZddlZddlZddlZdZdZdZdZedZeedd	edd
Z	dZ
dZdZd�Z
d�Zd�Zdefd��YZdejfd��YZdefd��YZdefd��YZdefd��YZd�Zedkr1e�ej�ndS( s�      turtle-example-suite:

            tdemo_nim.py

Play nim against the computer. The player
who takes the last stick is the winner.

Implements the model-view-controller
design pattern.
i����Ni�i�iiiiiii?i�i�cCstjtt�S(N(trandomtrandintt	MINSTICKSt	MAXSTICKS(((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyt	randomrowscCsy|d|dA|dA}|dkr0t|�SxBtd�D]4}|||A}|||kr=||f}|Sq=WdS(Niiii(t
randommovetrange(tstatetxoredtztstmove((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pytcomputerzug!s
cCsot|�}x6trDtjdd�}|||dkkrPqqWtj|dk||d�}||fS(Niii(tmaxtTrueRR(RtmR	trand((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyR+s	 tNimModelcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs
||_dS(N(tgame(tselfR((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyt__init__6scCsr|jjtjtjgkr"dSt�t�t�g|_d|_d|_	|jj
j�tj|j_dS(Ni(
RRtNimtCREATEDtOVERRtstickstplayertNonetwinnertviewtsetuptRUNNING(R((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyR9s		cCs�|j|}||j|<|jjj||||j�|j�rstj|j_|j|_	|jjj
�nI|jdkr�d|_t|j�\}}|j||�d|_ndS(Nii(
RRRtnotify_moveRt	game_overRRRRtnotify_overRR(Rtrowtcolt	maxspalte((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyRBs

	cCs|jdddgkS(Ni(R(R((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyR PscCs+|j||krdS|j||�dS(N(RR(RR"R#((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyRSs(t__name__t
__module__RRRR R(((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyR5s
					tStickcBs#eZd�Zd�Zd�ZRS(cCs�tjj|dt�||_||_||_|j||�\}}|jd�|j	t
dtd�|jd�|j
�|j||�|jd�|j�dS(Ntvisibletsquareg$@g4@itwhite(tturtletTurtleRtFalseR"R#Rtcoordstshapet	shapesizetHUNITtWUNITtspeedtputgototcolort
showturtle(RR"R#Rtxty((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyRZs			



cCskt|d�\}}dd|d|t}dd|t}|tdtdtd|tdfS(Niiii(tdivmodR2R1tSCREENWIDTHtSCREENHEIGHT(RR"R#tpackett	remainderR8R9((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyR.hscCs9|jjtjkrdS|jjj|j|j�dS(N(RRRRt
controllerRR"R#(RR8R9((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pytmakemovens(R%R&RR.R@(((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyR'Ys		tNimViewcBsAeZd�Zdd�Zd�Zd�Zd�Zd�ZRS(cCs�||_|j|_|j|_|jjd�|jjt�|jjd�tjdt�|_	|j	j
�|j	jd�i|_xJt
d�D]<}x3t
t�D]%}t|||�|j||f<q�Wq�W|jd�|jjt�dS(Ni�i�R(iis... a moment please ...(i�i�i�(Rtscreentmodelt	colormodettracerR-tbgcolorR+R,twriterR4R3RRRR'tdisplayR(RRR"R#((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyRus	
	'
cCs�|jjt�|jj�|dk	rt|jjdtdd�|jjd�|jj	|dddd�n|jjdtdd�|jjd�|jj	|dddd�|jjt
�dS(Niii0tredtaligntcentertfonttCourieritbolditblacki(RMiRN(RMiRN(RBRER-RGtclearRR5R<tpencolortwriteR(Rtmsg1tmsg2((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyRH�s
cCs�|jjt�xOtd�D]A}x8t|jj|�D] }|j||fjt�q:WqWxRtd�D]D}x;t|jj|t�D] }|j||fjd�q�WqoW|j	d�|jjt
�dS(NiR*s*Your turn! Click leftmost stick to remove.(RBRER-RRCRR6tSCOLORRRHR(RR"R#((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyR�s" "
cCs�|dkrIt}x�t||�D] }|j||fj|�q"Wn�|jd�tjd�|jd�t}xIt|d|dd�D]-}tjd�|j||fj|�q�W|jd�dS(	Nis ... thinking ...         g�?s ... thinking ... aaah ...ii����g�������?s*Your turn! Click leftmost stick to remove.(tHCOLORRRR6RHttimetsleeptCOLOR(RR"R#R$RtfarbeR
((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyR�s!


!
cCs8|jjjdkrd}nd}|jd|�dS(NisCongrats. You're the winner!!!s"Sorry, the computer is the winner.s2To play again press space bar. To leave press ESC.(RRCRRH(RRT((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyR!�s	cCs)|jjtjkr%|jj�ndS(N(RRRRRBRP(R((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyRP�sN(	R%R&RRRHRRR!RP(((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyRAts	
			t
NimControllercBseZd�Zd�ZRS(cCs�||_|jj|_t|_x'|jj�D]}|j|j�q1W|jjj	|jj
jd�|jjj	|jjjd�|jjj
d�|jjj�dS(NtspacetEscapesPress space bar to start game(RRRR-tBUSYtvaluestonclickR@RBtonkeyRCRRPRHtlisten(RRtstick((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyR�s		cCs9|jr
dSt|_|jjj||�t|_dS(N(R^RRRCRR-(RR"R#((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyR�s
		(R%R&RR(((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyR[�s	RcBs#eZdZdZdZd�ZRS(iiicCsFtj|_||_t|�|_t|�|_t|�|_	dS(N(
RRRRBRRCRARR[R?(RRB((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyR�s
	(R%R&RRRR(((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyR�scCs9tj�}|jd�|jtt�t|�}dS(Ntstandards
EVENTLOOP!(R+tScreentmodeRR;R<R(t
mainscreentnim((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pytmain�s

t__main__(i?i?i(i�i�i�(i�i�i�(t__doc__R+RRWR;R<RRR1R2RURVRYRRRtobjectRR,R'RAR[RRiR%tmainloop(((s-/usr/lib64/python2.7/Demo/turtle/tdemo_nim.pyt<module>
s0
		
	
$E	

Filemanager

Name Type Size Permission Actions
about_turtle.txt File 3.44 KB 0644
about_turtledemo.txt File 302 B 0644
demohelp.txt File 2.96 KB 0644
tdemo_I_dontlike_tiltdemo.py File 1.05 KB 0755
tdemo_I_dontlike_tiltdemo.pyc File 1.62 KB 0644
tdemo_I_dontlike_tiltdemo.pyo File 1.62 KB 0644
tdemo_bytedesign.py File 4.12 KB 0755
tdemo_bytedesign.pyc File 5.19 KB 0644
tdemo_bytedesign.pyo File 5.19 KB 0644
tdemo_chaos.py File 951 B 0644
tdemo_chaos.pyc File 2.24 KB 0644
tdemo_chaos.pyo File 2.24 KB 0644
tdemo_clock.py File 3.14 KB 0755
tdemo_clock.pyc File 4.43 KB 0644
tdemo_clock.pyo File 4.43 KB 0644
tdemo_colormixer.py File 1.31 KB 0644
tdemo_colormixer.pyc File 2.31 KB 0644
tdemo_colormixer.pyo File 2.31 KB 0644
tdemo_fractalcurves.py File 3.33 KB 0755
tdemo_fractalcurves.pyc File 3.44 KB 0644
tdemo_fractalcurves.pyo File 3.44 KB 0644
tdemo_lindenmayer_indian.py File 2.38 KB 0755
tdemo_lindenmayer_indian.pyc File 3.52 KB 0644
tdemo_lindenmayer_indian.pyo File 3.52 KB 0644
tdemo_minimal_hanoi.py File 2 KB 0755
tdemo_minimal_hanoi.pyc File 3.54 KB 0644
tdemo_minimal_hanoi.pyo File 3.54 KB 0644
tdemo_nim.py File 6.36 KB 0644
tdemo_nim.pyc File 9.16 KB 0644
tdemo_nim.pyo File 9.16 KB 0644
tdemo_paint.py File 1.26 KB 0755
tdemo_paint.pyc File 1.86 KB 0644
tdemo_paint.pyo File 1.86 KB 0644
tdemo_peace.py File 1.04 KB 0755
tdemo_peace.pyc File 1.36 KB 0644
tdemo_peace.pyo File 1.36 KB 0644
tdemo_penrose.py File 3.45 KB 0755
tdemo_penrose.pyc File 5.86 KB 0644
tdemo_penrose.pyo File 5.86 KB 0644
tdemo_planet_and_moon.py File 2.76 KB 0755
tdemo_planet_and_moon.pyc File 4.43 KB 0644
tdemo_planet_and_moon.pyo File 4.43 KB 0644
tdemo_tree.py File 1.38 KB 0755
tdemo_tree.pyc File 2.07 KB 0644
tdemo_tree.pyo File 2.07 KB 0644
tdemo_two_canvases.py File 1.09 KB 0644
tdemo_two_canvases.pyc File 1.6 KB 0644
tdemo_two_canvases.pyo File 1.6 KB 0644
tdemo_wikipedia.py File 1.32 KB 0644
tdemo_wikipedia.pyc File 1.91 KB 0644
tdemo_wikipedia.pyo File 1.91 KB 0644
tdemo_yinyang.py File 807 B 0755
tdemo_yinyang.pyc File 1.29 KB 0644
tdemo_yinyang.pyo File 1.29 KB 0644
turtle.cfg File 160 B 0644
turtleDemo.py File 9.85 KB 0755
turtleDemo.pyc File 10.69 KB 0644
turtleDemo.pyo File 10.69 KB 0644