Re: Trying to make a basic Python score counter in a game... will not count.
Actually, I was just going to post that it wasn't saving the scores. Great timing, I'll try it. -- http://mail.python.org/mailman/listinfo/python-list
Re: Trying to make a basic Python score counter in a game... will not count.
On Sunday, December 16, 2012 12:16:34 PM UTC-5, [email protected] 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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Trying to make a basic Python score counter in a game... will not count.
On Sunday, December 16, 2012 12:50:18 PM UTC-5, Kwpolska wrote: > On Sun, Dec 16, 2012 at 6:44 PM, tbg wrote: > > > 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 > > > -- > > > http://mail.python.org/mailman/listinfo/python-list > > > > Put this on top of your function: > > > > global winx, winy > > > > > > PS. Why did you put those delays in? They are useless. > > -- > > Kwpolska <http://kwpolska.tk> > > stop html mail | always bottom-post > > www.asciiribbon.org | www.netmeister.org/news/learn2quote.html > > GPG KEY: 5EAAEA16 I figured it would be too much for the person playing the game. Getting attacked with lines of text and all. Although it is a pain developing with it. And by the way, works perfectly now. Thanks for your help. -- http://mail.python.org/mailman/listinfo/python-list
Re: Trying to make a basic Python score counter in a game... will not count.
On Sunday, December 16, 2012 1:07:16 PM UTC-5, Mitya Sirenef wrote: > On 12/16/2012 12:00 PM, Darrien Glasser 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 > > > > > > Thanks in advance for your help... > > > > > > I was actually thinking of making a simple rock paper scissors game so I > > went ahead and cobbled it together, using a design with a class and > > generally a structured approach.. It keeps the scores, too, and you can > > set both players to be AI, or one to be AI, or both to be humans: > > > > https://github.com/pythonbyexample/PBE/blob/master/code/rockpaper.py > > > > (it needs python3 but can be easily changed to work with python2.x) > > > > > > - mitya > > > > -- > > Lark's Tongue Guide to Python: http://lightbird.net/larks/ Well there goes my hopes and dreams of being the first one to do that. Nice job by the way. -- http://mail.python.org/mailman/listinfo/python-list
Re: Trying to make a basic Python score counter in a game... will not count.
Nice, will have to try it out... -- http://mail.python.org/mailman/listinfo/python-list
