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

Mitya Sirenef msirenef at lightbird.net
Sun Dec 16 19:23:10 CET 2012


On 12/16/2012 01:17 PM, tbg wrote:
> 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.

Well you were the first :-)  I just did it to illustrate a modular 
approach, I think a
simple game like that is a great learning opportunity.

I posted an update with some small cleanups just now..

-- 
Lark's Tongue Guide to Python: http://lightbird.net/larks/




More information about the Python-list mailing list