On 24 mar, 11:24, Calcpage <calcp...@aol.com> wrote:
> Well, the examples i've seen of @interact allow input at the beginning  
> of a process such as a loop. That's great but my students were making  
> a rock, scissors, paper, lizard, Spock game where they wanted to have  
> a computer player vs a human player. The program needs to stop after  
> every round to ask for input several times for the human player during  
> a typical game. I had them write a simulation instead whereby the  
> human and computer players just used random choices. I think we did  
> "from Random import choice" and in the code we used "choice('rpslk')".

You can use global variables and auto_update=False. I wrote a example
regarding Nim:

http://wiki.sagemath.org/interact/games#Nim

If you use just one text input, it's not very different to using
input(), but it's a bit hacky and maybe you don't want to explain why
this works...

-- 
You received this message because you are subscribed to the Google Groups 
"sage-edu" group.
To post to this group, send email to sage-edu@googlegroups.com.
To unsubscribe from this group, send email to 
sage-edu+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-edu?hl=en.

Reply via email to