
    Mg
                     R    S SK J r   S SKrS SKrS SKr\ " S5       " S S5      5       rg)    )pluginNmemoryc                   0    \ rS rSrSrS rS rS rS rSr	g)	Memory   a  
Welcome to the Short-Term Memory Trainer! Here you can find
all the functionalities of this plugin.
Usage: Type memory, press enter and follow the instructions
Functionalities: You can train your memory by recalling a
random generated number.
Find out how many digits you can remember.
c                     UR                  S5        UR                  S5        UR                  S5        UR                  S5        U R                  U5      nUS:X  a  U R                  U5        g g )NzWelcome to Memory Trainer.z1We will train you by giving a number to remember.z*The number won't be visible for very long.z+Each time the number will get 1 more digit.   )say
get_answertrainer)selfjarvissanswers       </Users/admin/workspace/ai/Jarvis/jarviscli/plugins/memory.py__call__Memory.__call__   sZ    

/0

FG

?@

@A(Q;LL     c                     UR                  S5          UR                  S5        [        [        S5      5      nUS:w  a  US:w  a  [        S5      e U$ ! [         a    [	        S5         Of = fM]  )zW
Asks the user you check if he is ready to start the game
1 for ready, 2 for not ready
zAre you ready to play?z!Press 1 for Yes. 
Press 2 for No.zYour choice: r	      zPlease give a valid input)r
   intinput
ValueErrorprint)r   r   cs      r   r   Memory.get_answer   sw    
 	

+,3

?@o./6a1f$%@AA   3123 s   <A A+*A+c                    SnSnU(       Gdf  U R                  X5      n[        S5        [        R                  R	                  U5        [        R                  R                  5         [        R                  " S[        U5      -  5        [        R                  R	                  S5        [        R                  R                  5         UR                  S5        [        [        S5      5      nXC:X  a*  UR                  S[        [        U5      5      -   S	-   5        OPUR                  S
5        UR                  S[        [        U5      S-
  5      -   S	-   5        UR                  S5        SnU(       d  GMf  g)ze
User guesses the number, checks if the guess is correct.
First wrong guess means the user has lost.
F z2The number will only be visible for a few seconds.r   zTime ended.zType your guess:zCorrect guess of z digitszWrong guess.zYou remembered r	   zBe sure to train again.TN)create_numberr   sysstdoutwriteflushtimesleeplenr
   strr   )r   r   lostnumberguesss        r   r   Memory.trainer.   s   
 ''7FFGJJV$JJJJq3v;'JJT"JJJJ}%012E

.S[1AAIMN

>*

,s3v;?/CCiOP

45! $" 	r   c                     SnSnU[        U5      ::  a:  [        [        R                  " SS5      5      nX5-   nUS-   nU[        U5      ::  a  M:  U$ )z(
Creates new number with one more digit
r   r   	   r	   )r'   r(   randomrandint)r   r   r*   newidigits         r   r    Memory.create_numberH   sT     CKq!,-E+CAA CK 
r    N)
__name__
__module____qualname____firstlineno____doc__r   r   r   r    __static_attributes__r5   r   r   r   r      s    	"4
r   r   )r   r%   r/   r!   r   r5   r   r   <module>r<      s2       
 J J Jr   