[Tutor] rock, paper, scissors

Christopher Spears cspears2002 at yahoo.com
Sat Aug 12 00:39:21 CEST 2006


--- Tom Wilson <tpwilson at hotmail.co.uk> wrote:

> hi,
> 
> could you please explain to me how your rock paper
> scissors game script 
> works because i am a bit confused.
> 
> thanks
> tom
> 
> 

The game does not work in its current form, which may
be some cause for confusion.  :-)

In designing the program, I took the object oriented
route.  Why?  When I started to design the game, I
imagined two characters (a human and a computer)
playing against each other.  Each character has
similar attributes, i.e. points and a choice, and
behavoir.  They play.  The behavoir is implemented
differently for each character because how a computer
makes a decision is different from how a human makes a
decision.

After the characters decide which object to pick, a
function called compare_objects compares the objects
and uses logic to determine the winner.  After the
winner is picked, points are incremented and play
continues until one character reaches a set number of
points.

The two problem areas are the compare_objects function
and the while loop.  They don't work.  (At least, not
well.)  However, I have gotten several useful tips
from tutors, so I will be making a lot of progress
next week!


-Chris




More information about the Tutor mailing list