"Rikard Bosnjakovic" <[EMAIL PROTECTED]> wrote
> On 2/14/07, Nathan Pinno <[EMAIL PROTECTED]> wrote:
>
>>  I wrote a rock, paper, scissors game and every time you play 
>> without
>> exiting, it chooses the same number. How can I fix this problem? 
>> The
>> relative code is below:
> [...]
>>         compchoice = choice(range(3))
> [...]
>
>>>> range(3)
> [0, 1, 2]
>
> You either have to change your if-case ranges from 1-3 to 0-2, or
> simply add one to the "compchoice" variable.

I don't think that's a problem. The fact that the computers numbers
don't correspond with the users numbers shouldn't matter provided
the 'if' tests align with the choice result, which they do.

I've now tried running it on my PC and get:

=================
>>> Welcome to Rock, Paper, or Scissors!
by Nathan Pinno
© 2007. All rights reserved.

AI chose scissors.
You chose rock. You win!
AI chose rock.
You chose paper. You win!
AI chose scissors.
You chose scissors. Tie game.
Goodbye.
==================
Which all looks fine.

What exactly was the problem you found Nathan?

Alan G. 


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to