I want games
to update when check()
is called, but as soon as `games += 1`` runs, it creates a new object (a python quirk) rather than modifying the argument. but I want to modify the argument, so how do I do that?
right now wins
and games
reset to 0 after check() returns
def check(...games, wins,...):
...
games += 1
wins += 1 if winner == 'agent' \
else 0 if winner == 'bot' \
else 0.5
...
return 1
return 0
def play_bot():
games = 0
wins = 0
...
if check(...games, wins,...): player = choice([0,1])
...
I've been able to find stuff about why python creates a new object, but not a clean way to prevent this.