Ñò c™ÀEc@s<dZddkZddkZddkZdddgZd„Zd„Zeidƒdj oPddk Z ddk Z ddk Z ddk Z e i ƒd „Zd „Zneeiƒd joCddkZddk Z ddkZd „Zd „Zd„Zn(ddkZd„Zd„Zd„ZeƒdS(sÎOnline RPS client module by David Bau This code is in the public domain. You are free to use it as you like, and it comes with no warranties. So your mileage may vary. RPS clients can play in the RPS arena at http://davidbau.com:8088/. To play a match, just do this: for turn in xrange(rps.turns): = rps.play() The moves are 0 for rock, 1 for paper, 2 for scissors. Winning consistently against good players is harder than it looks. iÿÿÿÿNtrocktpapertscissorscCs |ddS(Nii((ti((s*/usr/www/users/davidbau/cgi-bin/rps/rps.pytbeatscCs |ddS(Nii((R((s*/usr/www/users/davidbau/cgi-bin/rps/rps.pytlosetostGATEWAY_INTERFACEcCs.tititdt|ƒiƒiƒƒS(Ns?play=(trpstindexturllibturlopenturltreadtstrip(tmy((s*/usr/www/users/davidbau/cgi-bin/rps/rps.pytplayscCs0tiƒ}| odttiddƒoMttidiƒiƒ}tii dt |ƒ|fƒti dƒn|i ddƒat|i ddƒƒa|i ddƒatdjptdjp td jotd ƒ‚ntdj otittƒƒntii d ƒtiiƒdS( Nt__main__t__file__s2Content-Type: text/plain Content-Length: %d %siR tturnss-1tseedi's Bad inputs Content-Type: text/plain rps (tcgit FieldStoragethasattrtsystmodulestfileRR tstdouttwritetlentexittgetfirsttNoneR tintRRt Exceptiontrandomtflush(tfieldsttext((s*/usr/www/users/davidbau/cgi-bin/rps/rps.pytsetup"s  ' ic CsÌtidƒ}|idddddddd ƒ|iƒ\}}|d }t|ƒd jod pt|d ƒati|i d ti |ƒtfƒi ƒi ƒa d d d gatitƒdS(Ns3usage: \%prog --arena ts--arenatdesttarenatdefaultshttp://davidbau.com:8088/singlethelpsArena server to useiiids?player=%s&turns=%d(toptparset OptionParsert add_optiont parse_argsRR RR R R)tquoteR R R twinstatexittregistertfinish(tparsertoptionstargstopponent((s*/usr/www/users/davidbau/cgi-bin/rps/rps.pyR&7s   *&cCs«tititdt|ƒiƒiƒƒ}t||dcd7(((s*/usr/www/users/davidbau/cgi-bin/rps/rps.pyR4fs  (t__doc__tosRR"RRRtgetenvRR Rtcgitbt tracebacktenableRR&RtargvR,R2R4(((s*/usr/www/users/davidbau/cgi-bin/rps/rps.pyts&$  0   $