
    Mg                     N    S SK r S SKJr  S SKJr  \" S5       " S S5      5       rg)    N)Back)pluginrockpaperscissorsc                   6    \ rS rSrSrS rS rS rS rS r	Sr
g	)
r      a  
rockpaperscissors Dcoumentation.
rockpaperscssors is the game Rock - Paper - Scissors that we all know with Jarvis as opponent.

First of all you enter how many rounds you will play (max. 100).
And then the game starts.
In every round you will request to enter your move.

'r' for rock.
'p' for paper.
's' for scissors.

Also you can exit the game whenever you like by entering as move 'exit' and also you can display the score whenever
you want by entering 'score'.

You can display the current round by entering 'rounds'.

c                    UR                  S5        UR                  S5        U R                  S5      nUR                  S5        UR                  S5        SnSnSnSnU[        U5      ::  Ga  U R                  S	5      nUS
:X  a  SnGOUS:X  a  S[	        U5      -   S-   [	        U5      -   S-   n	XE:  a(  U	[
        R                  -   S-   [
        R                  -   n	OTXE:  a(  U	[
        R                  -   S-   [
        R                  -   n	O'U	[
        R                  -   S-   [
        R                  -   n	UR                  U	5        M  US:X  a/  UR                  S[	        U5      -   S-   [	        U5      -   5        GM  U R                  5       n
UR                  SU
-   5        U R                  X5      nUS:X  aA  US-   nUR                  S[
        R                  -   S-   [
        R                  -   5        US-   nOUS:X  aA  US-   nUR                  S[
        R                  -   S-   [
        R                  -   5        US-   nO;UR                  S[
        R                  -   S-   [
        R                  -   5        US-   nU[        U5      ::  a  GM  UR                  S5        UR                  S5        UR                  S5        UR                  S [	        U5      -   S-   S!-   [	        U5      -   5        XE:  a%  [
        R                  S"-   [
        R                  -   n	ONXE:  a%  [
        R                  S#-   [
        R                  -   n	O$[
        R                  S$-   [
        R                  -   n	USL aN  [	        US-
  5      nUS%:X  a  US&-   nOUS':X  a  US(-   nOUS):X  a  US*-   nOUS+-   nUR                  S,U-   S--   5        UR                  U	5        g ).Nz$!! Welcome to Rock Paper Scissors !!z%!A game to play with Jarvis as rival!z0Enter how many rounds you will play (max. 100): OKzThe game beginsr   F   zEnter your move: exitTscorezYou:z	  Jarvis:z  zYou Winningz
You LosingTieroundszThe current rounds is /zJarvis move: W	zYou WINLz
Jarvis WINTIE z		GAME OVERz		--SCORE--z	YOU: zJARVIS: z		YOU WIN!!z		YOU LOSE!z		TIE1st2nd3rdthzYou terminate the game at z round)say
get_roundsint	get_usersstrr   GREENRESETREDWHITE
get_jarvisgameMAGENTA)selfjarvissr   
user_scorejarvis_scorer   i	user_movetxtjarvis_movegrs                G/Users/admin/workspace/ai/Jarvis/jarviscli/plugins/rockpaperscissors.py__call__rockpaperscissors.__call__   s9   

9:

:;!ST

4

$%
3v;':;IV#W$s:.<s<?PPSWW-

*]:TZZGC..<7$**DC

*U2TZZ?C

3X%

3c!f<sBS[PQ//+KJJ45		)1AS'!^


4$**,y84::EFEs(+a/

4$((?\9DJJFGE

4$,,.6CDEO 3v;R 	

2

'(

'(

>C
O3d:ZG#lJ[[\%**.;C'((_,tzz9C**y(4::5CDLAE
ASHs(Hs(HHJJ3a7(BC

3    c                 Z     [        U5      n [        U5      S::  a  U$ Sn M"  !   Sn N= f)Nd   zLaps should be under 100 
zLaps should be a number 
)inputr   )r(   promptr   s      r3   r   rockpaperscissors.get_roundsq   s:    6]F6K3&!M:F 65s   $ $ *c                     / SQn [        U5      R                  5       nX2;   a   US:X  a  SnU$ US:X  a  SnU$ US:X  a  SnU$ U$ SnMC  )	N)	rockr2   paperpscissorsr*   r   r   r   r=   r2   r>   r?   r@   r*   zPlease enter a valid move: )r9   lower)r(   r:   movesus       r3   r   rockpaperscissors.get_users}   so    Wf##%AzKA  7lA  :oA  H 7r6   c                 >    / SQnU[         R                  " SS5         $ )N)r2   r?   r*   r      )randomrandint)r(   rB   s     r3   r%   rockpaperscissors.get_jarvis   s    V^^Aq)**r6   c                 p    SnX:X  a  SnU$ US:X  a  US:X  d  US:X  a  US:X  d  US:X  a
  US:X  a  SnU$ SnU$ )Nr   Tr2   r*   r?   r   r    )r(   umovejmove	conditions       r3   r&   rockpaperscissors.game   s`    	NI  #%3,ESLUc\W\`cWchmqtht	   	r6   rL   N)__name__
__module____qualname____firstlineno____doc__r4   r   r   r%   r&   __static_attributes__rL   r6   r3   r   r      s"    &Rh
6*+r6   )rG   coloramar   r   r   rL   r6   r3   <module>rX      s0       \ \ \r6   