ROOTPLOIT
Server: LiteSpeed
System: Linux server71.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: niphet (1079)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: //lib64/python2.7/Demo/turtle/tdemo_nim.pyc
ó
¿œ^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ƒqWqoW|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