Trying to make a basic Python score counter in a game... will not count.

tbg darrienglasser at gmail.com
Sun Dec 16 12:44:24 EST 2012


On Sunday, December 16, 2012 12:16:34 PM UTC-5, ru... at yahoo.com wrote:
> > Hey guys, I'm working on a Python rock paper scissors (lizard spock)
> 
> > game, and the beginning is complete. After I finished it, I thought,
> 
> > "You know what? I think I can make this even better, and add a score
> 
> > counter." And so I did.
> 
> > 
> 
> > The problem is that it doesn't seem to actually keep track of score.
> 
> > In fact it always keeps the score at 0 for both players. It's fully
> 
> > functional otherwise, but it's bothering me that I can't get it to
> 
> > work.
> 
> > 
> 
> > Currently using Windows Python 32 bit v2.6.8
> 
> > 
> 
> > Download of the code here:
> 
> > https://www.box.com/s/2lupxeyk5jvsxs0zkdfb
> 
> > 
> 
> > Copy of the code here:
> 
> > http://pastebin.com/MNdgiuSY
> 
> 
> 
> If you are keeping the score in 'winx 'and 'winy' then you are adding
> 
> one to the the values but not saving the results.
> 
> 
> 
> I think you want 
> 
> 
> 
>   winx = winx + 1
> 
> 
> 
> or more concisely,
> 
> 
> 
>   winx += 1

I changed it so that it said winx += 1 etc. and it doesn't seem to save it. I also tried pulling the variables from the loop and making them global variables at the top.

The latter game me a traceback error when printing out the results. Any ideas?

http://puu.sh/1BCbG

Code Preview/Download

https://www.box.com/s/jiu0259nohx0kae2am57



More information about the Python-list mailing list