I am new to dictionaries. Apparently they are in c# also. They are pretty neat, you don't have to "walk" them, so no need to use index counters.
i can query the dictionary pretty easily. For handling the players I have a function that returns a list of keys that start with a string:
Code:
def listkeys(data,keyprefix):
f_kl=[]
if keyprefix!='':
for k in data.keys():
if k.startswith(keyprefix):
f_kl.append(k)
else: f_kl=data.keys()
return f_kl
later I can use listkeys to make a list of player names:
Code:
playerlist=listkeys(data,"player_")
The problem with the duplicate players seemed that it was because I wasn't erasing the old query data properly (now fixed)
I will put in a function to double check for dup players, filter out the sentinels, and filter the random number guys...If for some reason the random number guy gets a high score (>1000), then I will assume it is a regular player.
Currently I am working on the changing the way data is stored on the disk. I am also working on a function to track total play time. I just finished a function that determines if a player left, now I have to determine when the end of game occurs. I think I can use the same function and just compare old time to new and if new is smaller than old, then old must have been from last map...or I guess I can just watch for a map change. If all else fails, I could just measure the time between queries (not as accurate though)