MOON
Server: Apache/2.2.34 (Unix) mod_ssl/2.2.34 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 FrontPage/5.0.2.2635
System: Linux server.asjudinet.com 2.6.32-042stab141.3 #1 SMP Fri Nov 15 22:45:34 MSK 2019 i686
User: asjudine (504)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: //usr/lib/python2.4/Demo/tkinter/guido/solitaire.pyo
mò
‚=5Dc@s9dZdkZdkZdkTdklZlZlZlZdefd„ƒYZdZ	dZ
dZe	d	eZe
d
eZ
dZdZd
ZdZdZdZdZdZhZxeefD]Zeee<qÅWxeefD]Zeee<qæWeiƒZeeƒZdZdZdZdZe ddƒZ!ee!ƒZ"ddge#e$e d	dƒƒdddgZ%dZ&dfd„ƒYZ'd fd!„ƒYZ(d"e(fd#„ƒYZ)d$„Z*d%e(fd&„ƒYZ+d'e+fd(„ƒYZ,d)e+fd*„ƒYZ-d+fd,„ƒYZ.d-„Z/e0d.joe/ƒndS(/sô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!

N(t*(s	Rectangles
CanvasTextsGroupsWindowtGroupcBstZddd„ZRS(NcCs|ii|i||ƒS(N(tselftcanvasttag_bindtidtsequencetcommand(RRR((t2/usr/lib/python2.4/Demo/tkinter/guido/solitaire.pytbind%s(t__name__t
__module__tNoneR	(((RR$sidi–i
iiis#070tHearttDiamondtClubtSpadetredtblackiiii
ittAtJtQtKitCardcBsMtZdZd„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
|tdddtd|id|ƒ|_|i
i|iƒt|ddttdddd	ƒ|_|i
i|iƒt|ttttttdddd
ƒ|_|i
i|iƒ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(tsuitRtvaluetCOLORtcolort
face_showntxtyRRtgrouptVALNAMESRt
CanvasTextt	CARDWIDTHtNt_Card__texttaddtag_withtagt	Rectanglet
CARDHEIGHTt_Card__recttMARGINt_Card__back(RRR RR((Rt__init__˜s$			
	cCsd|i|ifS(s+Return a string for debug print statements.sCard(%r, %r)N(RRR (R((Rt__repr__¸scCs"|i||i||iƒdS(s*Move the card to absolute position (x, y).N(RtmovebyR$R%(RR$R%((Rtmoveto¼scCs7|i||_|i||_|ii||ƒdS(sMove the card by (dx, dy).N(RR$tdxR%tdyR&tmove(RR6R7((RR4ÀscCs|iiƒdS(s5Raise the card above all other objects in its canvas.N(RR&ttkraise(R((RR9ÆscCs1|iƒ|iiƒ|iiƒd|_dS(sTurn the card's face up.iN(RR9R/R+R#(R((RtshowfaceÊs



cCs1|iƒ|iiƒ|iiƒd|_dS(sTurn the card's face down.iN(RR9R/R1R#(R((RtshowbackÑs



(
R
Rt__doc__R2R3R5R4R9R:R;(((RRss#	 					tStackcBs¹tZdZed„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d„Zd	„Zd
„Z
d„Zd„Zd
„Zd„Zd„ZeZd„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|iiƒ|_|iid|i	ƒ|iid|i
ƒ|iid|iƒ|iid|iƒ|i
ƒ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$RR%tgametcardsRRR&R	tclickhandlertdoubleclickhandlert
motionhandlertreleasehandlert
makebottom(RR$R%R>((RR2s				cCsdS(N((R((RRDscCsd|ii|i|ifS(s+Return a string for debug print statements.s
%s(%d, %d)N(Rt	__class__R
R$R%(R((RR3scCs>|ii|ƒ|iƒ|i|ƒ|ii|iƒdS(N(RR?tappendtcardR9tpositionR&R,(RRG((Rtadd%s

cCs'|ii|ƒ|ii|iƒdS(N(RR?tremoveRGR&tdtag(RRG((Rtdelete+scCs#|io|idiƒndS(Niÿÿÿÿ(RR?R:(R((Rtshowtop/s
cCs0|ipdSn|id}|i|ƒ|S(Niÿÿÿÿ(RR?RRGRL(RRG((Rtdeal3s



cCs|i|i|iƒdS(N(RGR5RR$R%(RRG((RRH<scCs|iƒdS(N(RRM(R((Rtuserclickhandler?scCs|iƒdS(N(RRO(R((RtuserdoubleclickhandlerBscCs"x|D]}|i|ƒqWdS(N(R?RGRRH(RR?RG((RtusermovehandlerEscCs%|iƒ|iƒ|i|ƒdS(N(RtfinishmovingROtstartmovingtevent(RRT((RR@Ks

cCs|i|ƒdS(N(Rt
keepmovingRT(RRT((RRBPscCs|i|ƒ|iƒdS(N(RRURTRR(RRT((RRCSs
cCs%|iƒ|iƒ|i|ƒdS(N(RRRRPRSRT(RRT((RRAWs

cCsÃd|_|iiidƒ}xFtt|i	ƒƒD]+}|i	|}|ii
|joPq4q4WdS|ipdSn|i	||_|i|_|i|_x|iD]}|iƒq«WdS(Ntcurrent(RRtmovingR>RtgettagsttagstrangetlenR?tiRGR&ttagR#RTR$tlastxR%tlastyR9(RRTRYR\RG((RRS`s 	
	

cCs„|ipdSn|i|i}|i|i}|i|_|i|_|p|o(x%|iD]}|i
||ƒqbWndS(N(RRWRTR$R^R6R%R_R7RGR4(RRTRGR6R7((RRUqs

cCs.|i}d|_|o|i|ƒndS(N(RRWR?RRQ(RR?((RRR|s		(R
RR<RR2RDR3RIRLRMRNRHRORPRQR@RBRCRARWRSRURR(((RR=Ùs(-																	tDeckcBs2tZdZd„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|ii|i|i|it|itdddtƒ}|i
i|ƒdS(NRRR(R-RR>RR$R%R)R.t
BACKGROUNDtbottomR&R,(RRb((RRD’s
cCsEx>tD]6}x-tD]%}|it|||iiƒƒqWqWdS(N(	tALLSUITSRt	ALLVALUESR RRIRR>R(RR R((RR™s
cCsMt|iƒ}g}x(t|ƒD]}|i|i|ƒq"W||_dS(N(R[RR?tntnewcardstrandpermR\RF(RR\ReRf((Rtshuffležs
cCs{|ii}|iƒ}|p;xU|iƒ}|pPn|i|ƒ|iƒq"Wn|iii|ƒ|iƒdS(Ni(RR>topendeckRNRGRIR;R:(RRiRG((RRO¥s
(R
RR<RDRRhRO(((RR`ƒs

			cCsNt|ƒ}g}x5|o-ti|ƒ}|i|ƒ|i|ƒqW|S(s4Function returning a random permutation of range(n).N(	RZRetrR$trandomtchoiceR\RFRJ(ReR\RjR$((RRg´s
t	OpenStackcBs#tZd„Zd„Zd„ZRS(NcCsdS(Ni((RR?((Rt
acceptableÁscCs’|d}|ii|ƒ}|p||jp|i|ƒoti||ƒn9x(|D] }|i	|ƒ|i
|ƒq]W|iiƒdS(Ni(R?RGRR>tcloseststacktstackRnR=RQRLRItwincheck(RR?RpRG((RRQÄs
&
cCs•|ipdSn|id}|ip|iƒdSnxS|iiD]E}|i|gƒo,|i	|ƒ|i
|ƒ|iiƒPqHqHWdS(Niÿÿÿÿ(RR?RGR#ROR>tsuitstsRnRLRIRq(RRsRG((RRPÏs







(R
RRnRQRP(((RRm¿s		t	SuitStackcBs,tZd„Zd„Zd„Zd„ZRS(Nc
CsBt|ii|i|i|it|itddddƒ}dS(NRRRR(	R-RR>RR$R%R)R.Rb(RRb((RRDàscCsdS(N((R((RROæscCsdS(N((R((RRPéscCstt|ƒdjodSn|d}|ip|itjSn|id}|i|ijo|i|idjS(Niiiÿÿÿÿ(R[R?RGRR tACEttopcardR(RR?RvRG((RRnìs


(R
RRDRORPRn(((RRtÞs			tRowStackcBstZd„Zd„ZRS(NcCsk|d}|ip|itjSn|id}|ipdSn|i|ijo|i|idjS(Niiÿÿÿÿi(R?RGRR tKINGRvR#R"(RR?RvRG((RRnøs



cCsl|i}xI|iD]>}||joPn|io|dt}q|t}qW|i|i	|ƒdS(Ni(
RR%R?tcRGR#R0tOFFSETR5R$(RRGRyR%((RRHs	


(R
RRnRH(((RRwös		t	SolitairecBsGtZd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(NcCs×||_t|idtdddttddtdtƒ|_|ii	dt
d	tƒt|id
ddddtdd
d|i
ƒ|_t|itdtdd|idtƒt}t}t|||ƒ|_|t}t|||ƒ|_|t}g|_x:ttƒD],}|t}|iit|||ƒƒqWt}|t}g|_x:ttƒD],}|iit|||ƒƒ|t}qoW|ig|i|i|_|ii ƒ|i
ƒdS(Nt
backgroundthighlightthicknessitwidththeightiiRtexpandRtDealtactivebackgroundtgreenRtwindowR(!tmasterRtCanvasRatNROWStXSPACINGtYSPACINGR0RtpacktBOTHtTRUEtButtonRNt
dealbuttontWindowtSWR$R%R`tdeckRmRiRrRZtNSUITSR\RFRttrowsRwt
openstacksR(RR…R%R\R$((RR2sH		
	

	

 
	

cCsJx/|iD]$}t|iƒtjodSq
q
W|iƒ|iƒdS(N(RRrRsR[R?tNVALUEStwinRN(RRs((RRq=s

cCsig}x|iD]}||i}qWx;|o3ti|ƒ}|i|ƒ|i||i	ƒq*WdS(sStupid animation when you win.N(
R?RR”RsRkRlRGRJtanimatedmovetoR‘(RR?RsRG((RR–Ds

cCsgx`tdddƒD]L}|i|i||i|i|}}|i||ƒ|i
iƒqWdS(Ni
iiÿÿÿÿ(RZR\tdestR$RGR%R6R7R4RR…tupdate_idletasks(RRGR˜R\R6R7((RR—Ns
)cCsgd}d}xT|iD]I}|i|id|i|id}||jo|}|}qqW|S(NiÿÉš;i(
RtclosesttcdistRR”RpR$RGR%tdist(RRGRœRšR›Rp((RRoTs
&
cCs„|iƒ|iiƒxHttƒD]:}x1|i|D]"}|ii	ƒ}|i|ƒq8Wq$Wx|iD]}|iƒqlWdS(N(
RtresetR‘RhRZR‡R\R“RjRNRGRIRM(RR\RjRG((RRN`s



cCsRxK|iD]@}x7|iƒ}|pPn|ii|ƒ|iƒqWq
WdS(Ni(RR”RpRNRGR‘RIR;(RRpRG((RRjs
(	R
RR2RqR–R—RoRNR(((RR{
s	.		
			
cCs6tƒ}t|ƒ}|id|iƒ|iƒdS(NtWM_DELETE_WINDOW(tTktrootR{R>tprotocoltquittmainloop(R>R ((Rtmainvs	t__main__(1R<tmathRktTkinterR†R-R(RRR)R.R0RˆR‰RzRatHEARTStDIAMONDStCLUBStSPADEStREDtBLACKR!RstkeysRcR[R’RutJACKtQUEENRxRZRdR•tmaptstrR'R‡RR=R`RgRmRtRwR{R¤R
((RRuRkRR­RaR•RdRˆRmR¬RxR‰R’R‡RªR-R'R¨R¤R.R¦R(RcRgR)R¯RzR«R`R°RwR=R!RsRR©RtR0R{((Rt?s\		


/fª1	i