Fixed order of op

This commit is contained in:
sloumdrone 2019-04-29 22:56:17 -07:00
parent 05046965a6
commit 8a81ac1e54
1 changed files with 1 additions and 1 deletions

2
oberon
View File

@ -96,8 +96,8 @@ def play_game(gid):
v2 = (json.dumps(play['board']), state['turn_number'] + 1, play['winner'], gid)
res2 = db_do(q2, v2, True)
if play['winner']:
msg_path = '/home/{}/.oberon'.format(enemy)
enemy = state['p1'] if state['p1'] != username else state['p2']
msg_path = '/home/{}/.oberon'.format(enemy)
writemode = 'a' if fileexists(msg_path) else 'w'
with open(msg_path, writemode) as f:
f.write('{} defeated you in {} game {}\n'.format(username, state['game_type'], gid))