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/tkinter/guido/solitaire.pyc
ó
Afc@sCdZddlZddlZddlTddlmZmZmZmZdefd„ƒYZdZ	dZ
d	Ze	d
eZe
deZ
dZd
ZdZdZdZdZdZdZiZxeefD]Zeee<qÑWxeefD]Zeee<qòWejƒZeeƒZdZdZdZdZe ddƒZ!ee!ƒZ"ddge#e$e d
dƒƒdddgZ%dZ&dd0d „ƒYZ'd!d1d"„ƒYZ(d#e(fd$„ƒYZ)d%„Z*d&e(fd'„ƒYZ+d(e+fd)„ƒYZ,d*e+fd+„ƒYZ-d,d2d-„ƒYZ.d.„Z/e0d/kr?e/ƒndS(3sôSolitaire game, much like the one that comes with MS Windows.

Limitations:

- No cute graphical images for the playing cards faces or backs.
- No scoring or timer.
- No undo.
- No option to turn 3 cards at a time.
- No keyboard shortcuts.
- Less fancy animation when you win.
- The determination of which stack you drag to is more relaxed.

Apology:

I'm not much of a card player, so my terminology in these comments may
at times be a little unusual.  If you have suggestions, please let me
know!

iÿÿÿÿN(t*(t	Rectanglet
CanvasTexttGrouptWindowRcBseZddd„ZRS(cCs|jj|j||ƒS(N(tcanvasttag_bindtid(tselftsequencetcommand((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytbind%sN(t__name__t
__module__tNoneR(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR$sidi–i
iiis#070tHearttDiamondtClubtSpadetredtblackiiii
ittAtJtQtKitCardcBsMeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	RS(sA playing card.

    A card doesn't record to which stack it belongs; only the stack
    records this (it turns out that we always know this from the
    context, and this saves a ``double update'' with potential for
    inconsistencies).

    Public methods:

    moveto(x, y) -- move the card to an absolute position
    moveby(dx, dy) -- move the card by a relative offset
    tkraise() -- raise the card to the top of its stack
    showface(), showback() -- turn the card face up or down & raise it

    Public read-only instance variables:

    suit, value, color -- the card's suit, value and color
    face_shown -- true when the card is shown face up, else false

    Semi-public read-only instance variables (XXX should be made
    private):

    group -- the Canvas.Group representing the card
    x, y -- the position of the card's top left corner

    Private instance variables:

    __back, __rect, __text -- the canvas items making up the card

    (To show the card face up, the text item is placed in front of
    rect and the back is placed behind it.  To show it face down, this
    is reversed.  The card is created face down.)

    c
Cs||_||_t||_d|_d|_|_t|ƒ|_dt	||f}t
|tdddtd|jd|ƒ|_
|jj|j
ƒt|ddttdddd	ƒ|_|jj|jƒt|ttttttdddd
ƒ|_|jj|jƒdS(sCard constructor.

        Arguments are the card's suit and value, and the canvas widget.

        The card is created at position (0, 0), with its face down
        (adding it to a stack will position it according to that
        stack's rules).

        is%s  %sitanchortfillttexttoutlineRtwhitetblueN(tsuittvaluetCOLORtcolort
face_showntxtyRtgrouptVALNAMESRt	CARDWIDTHtNt_Card__texttaddtag_withtagRt
CARDHEIGHTt_Card__recttMARGINt_Card__back(RR!R"RR((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyt__init__˜s"
		
	cCsd|j|jfS(s+Return a string for debug print statements.sCard(%r, %r)(R!R"(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyt__repr__¸scCs"|j||j||jƒdS(s*Move the card to absolute position (x, y).N(tmovebyR&R'(RR&R'((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytmoveto¼scCs7|j||_|j||_|jj||ƒdS(sMove the card by (dx, dy).N(R&R'R(tmove(Rtdxtdy((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR4ÀscCs|jjƒdS(s5Raise the card above all other objects in its canvas.N(R(ttkraise(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR9ÆscCs1|jƒ|jjƒ|jjƒd|_dS(sTurn the card's face up.iN(R9R/R,R%(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytshowfaceÊs


cCs1|jƒ|jjƒ|jjƒd|_dS(sTurn the card's face down.iN(R9R/R1R%(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytshowbackÑs


(
RR
t__doc__R2R3R5R4R9R:R;(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRss#	 					tStackcBs¹eZdZdd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d„Zd	„Zd
„Z
d„Zd„Zd
„Zd„Zd„ZdZd„Zd„Zd„ZRS(sÌA generic stack of cards.

    This is used as a base class for all other stacks (e.g. the deck,
    the suit stacks, and the row stacks).

    Public methods:

    add(card) -- add a card to the stack
    delete(card) -- delete a card from the stack
    showtop() -- show the top card (if any) face up
    deal() -- delete and return the top card, or None if empty

    Method that subclasses may override:

    position(card) -- move the card to its proper (x, y) position

        The default position() method places all cards at the stack's
        own (x, y) position.

    userclickhandler(), userdoubleclickhandler() -- called to do
    subclass specific things on single and double clicks

        The default user (single) click handler shows the top card
        face up.  The default user double click handler calls the user
        single click handler.

    usermovehandler(cards) -- called to complete a subpile move

        The default user move handler moves all moved cards back to
        their original position (by calling the position() method).

    Private methods:

    clickhandler(event), doubleclickhandler(event),
    motionhandler(event), releasehandler(event) -- event handlers

        The default event handlers turn the top card of the stack with
        its face up on a (single or double) click, and also support
        moving a subpile around.

    startmoving(event) -- begin a move operation
    finishmoving() -- finish a move operation

    cCsŸ||_||_||_g|_t|jjƒ|_|jjd|jƒ|jjd|j	ƒ|jjd|j
ƒ|jjd|jƒ|jƒdS(sStack constructor.

        Arguments are the stack's nominal x and y position (the top
        left corner of the first card placed in the stack), and the
        game object (which is used to get the canvas; subclasses use
        the game object to find other stacks).

        s<1>s
<Double-1>s<B1-Motion>s<ButtonRelease-1>N(
R&R'tgametcardsRRR(Rtclickhandlertdoubleclickhandlert
motionhandlertreleasehandlert
makebottom(RR&R'R>((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR2s					cCsdS(N((R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRDscCsd|jj|j|jfS(s+Return a string for debug print statements.s
%s(%d, %d)(t	__class__RR&R'(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR3scCs>|jj|ƒ|jƒ|j|ƒ|jj|jƒdS(N(R?tappendR9tpositionR(R-(Rtcard((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytadd%s

cCs'|jj|ƒ|jj|jƒdS(N(R?tremoveR(tdtag(RRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytdelete+scCs!|jr|jdjƒndS(Niÿÿÿÿ(R?R:(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytshowtop/s	cCs+|js
dS|jd}|j|ƒ|S(Niÿÿÿÿ(R?RRL(RRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytdeal3s
	

cCs|j|j|jƒdS(N(R5R&R'(RRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRG<scCs|jƒdS(N(RM(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytuserclickhandler?scCs|jƒdS(N(RO(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytuserdoubleclickhandlerBscCs"x|D]}|j|ƒqWdS(N(RG(RR?RH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytusermovehandlerEs
cCs%|jƒ|jƒ|j|ƒdS(N(tfinishmovingROtstartmoving(Rtevent((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR@Ks

cCs|j|ƒdS(N(t
keepmoving(RRT((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRBPscCs|j|ƒ|jƒdS(N(RURR(RRT((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRCSs
cCs%|jƒ|jƒ|j|ƒdS(N(RRRPRS(RRT((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRAWs

cCs¼d|_|jjjdƒ}xDtt|jƒƒD])}|j|}|jj	|kr4Pq4q4WdS|j
srdS|j||_|j|_|j
|_x|jD]}|jƒq¤WdS(Ntcurrent(RtmovingR>RtgettagstrangetlenR?R(ttagR%R&tlastxR'tlastyR9(RRTttagstiRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRS`s	
	cCs||js
dS|j|j}|j|j}|j|_|j|_|sQ|rxx$|jD]}|j||ƒq[WndS(N(RWR&R\R'R]R4(RRTR7R8RH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRUqs	cCs,|j}d|_|r(|j|ƒndS(N(RWRRQ(RR?((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRR|s		N(RR
R<RR2RDR3RIRLRMRNRGRORPRQR@RBRCRARWRSRURR(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR=Ùs(-																	tDeckcBs2eZdZd„Zd„Zd„Zd„ZRS(s7The deck is a stack with support for shuffling.

    New methods:

    fill() -- create the playing cards
    shuffle() -- shuffle the playing cards

    A single click moves the top card to the game's open deck and
    moves it face up; if we're out of cards, it moves the open deck
    back to the deck.

    c
CsRt|jj|j|j|jt|jtdddtƒ}|jj	|ƒdS(NRRR(
RR>RR&R'R*R.t
BACKGROUNDR(R-(Rtbottom((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRD’s
cCsEx>tD]6}x-tD]%}|jt|||jjƒƒqWqWdS(N(tALLSUITSt	ALLVALUESRIRR>R(RR!R"((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR™s

cCsMt|jƒ}g}x(t|ƒD]}|j|j|ƒq"W||_dS(N(RZR?trandpermRF(RtntnewcardsR_((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytshuffležs
cCsv|jj}|jƒ}|sUxQ|jƒ}|s7Pn|j|ƒ|jƒq!Wn|jjj|ƒ|jƒdS(N(R>topendeckRNRIR;R:(RRiRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRO¥s
(RR
R<RDRRhRO(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR`ƒs

			cCsLt|ƒ}g}x3|rGtj|ƒ}|j|ƒ|j|ƒqW|S(s4Function returning a random permutation of range(n).(RYtrandomtchoiceRFRJ(RftrR&R_((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRe´s	
t	OpenStackcBs#eZd„Zd„Zd„ZRS(cCsdS(Ni((RR?((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyt
acceptableÁscCsŽ|d}|jj|ƒ}|s?||ks?|j|ƒrRtj||ƒn8x(|D] }|j|ƒ|j|ƒqYW|jjƒdS(Ni(R>tcloseststackRnR=RQRLRItwincheck(RR?RHtstack((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRQÄs
#

cCs‰|js
dS|jd}|js1|jƒdSxQ|jjD]C}|j|gƒr>|j|ƒ|j|ƒ|jjƒPq>q>WdS(Niÿÿÿÿ(	R?R%ROR>tsuitsRnRLRIRp(RRHts((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRPÏs	
	



(RR
RnRQRP(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRm¿s		t	SuitStackcBs,eZd„Zd„Zd„Zd„ZRS(c
CsBt|jj|j|j|jt|jtddddƒ}dS(NRRRR(RR>RR&R'R*R.(RRb((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRDàscCsdS(N((R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyROæscCsdS(N((R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRPéscCsit|ƒdkrdS|d}|js6|jtkS|jd}|j|jkoh|j|jdkS(Niiiÿÿÿÿ(RZR?R"tACER!(RR?RHttopcard((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRnìs
	

(RR
RDRORPRn(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRtÞs			tRowStackcBseZd„Zd„ZRS(cCs`|d}|js |jtkS|jd}|js:dS|j|jko_|j|jdkS(Niiÿÿÿÿi(R?R"tKINGR%R$(RR?RHRv((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRnøs
	

	cCsh|j}xE|jD]:}||kr)Pn|jrC|dt}q|t}qW|j|j|ƒdS(Ni(R'R?R%R0tOFFSETR5R&(RRHR'tc((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRGs		(RR
RnRG(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRwös		t	SolitairecBsGeZd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(cCs×||_t|jdtdddttddtdtƒ|_|jjdt	d	t
ƒt|jd
ddddtdd
d|jƒ|_
t|jtdtdd|j
dtƒt}t}t|||ƒ|_|t}t|||ƒ|_|t}g|_x:ttƒD],}|t}|jjt|||ƒƒqWt}|t}g|_x:ttƒD],}|jjt|||ƒƒ|t}qoW|jg|j|j|_|jjƒ|jƒdS(Nt
backgroundthighlightthicknessitwidththeightiiRtexpandRtDealtactivebackgroundtgreenR
twindowR(tmastertCanvasRatNROWStXSPACINGtYSPACINGR0RtpacktBOTHtTRUEtButtonRNt
dealbuttonRtSWR`tdeckRmRiRrRYtNSUITSRFRttrowsRwt
openstacksR(RR…R&R'R_((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR2sD	


	
 
	
cCsEx*|jD]}t|jƒtkr
dSq
W|jƒ|jƒdS(N(RrRZR?tNVALUEStwinRN(RRs((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRp=s

cCsgg}x|jD]}||j}qWx9|rbtj|ƒ}|j|ƒ|j||jƒq*WdS(sStupid animation when you win.N(R“R?RjRkRJtanimatedmovetoR(RR?RsRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR•Ds	
cCsgx`tdddƒD]L}|j|j||j|j|}}|j||ƒ|jjƒqWdS(Ni
iiÿÿÿÿ(RYR&R'R4R…tupdate_idletasks(RRHtdestR_R7R8((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR–Ns)cCsed}d}xR|jD]G}|j|jd|j|jd}||kr|}|}qqW|S(NiÿÉš;i(RR“R&R'(RRHtclosesttcdistRqtdist((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRoTs&
cCs„|jƒ|jjƒxHttƒD]:}x1|j|D]"}|jjƒ}|j|ƒq8Wq$Wx|jD]}|jƒqlWdS(N(	tresetRRhRYR‡R’RNRIRM(RR_RlRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRN`s

cCsOxH|jD]=}x4|jƒ}|s)Pn|jj|ƒ|jƒqWq
WdS(N(R“RNRRIR;(RRqRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRœjs(	RR
R2RpR•R–RoRNRœ(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR{
s	.		
			
cCs6tƒ}t|ƒ}|jd|jƒ|jƒdS(NtWM_DELETE_WINDOW(tTkR{tprotocoltquittmainloop(trootR>((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytmainvs	t__main__((((1R<tmathRjtTkinterR†RRRRR*R.R0RˆR‰RyRatHEARTStDIAMONDStCLUBStSPADEStREDtBLACKR#RstkeysRcRZR‘RutJACKtQUEENRxRYRdR”tmaptstrR)R‡RR=R`ReRmRtRwR{R£R(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyt<module>sX
"
/fª1	i