Skip to content

Commit

Permalink
Fixed updating the score after sending final results to before sendin…
Browse files Browse the repository at this point in the history
…g, so players see the updated score when the game ends.
  • Loading branch information
jporubci committed Jul 16, 2023
1 parent a92090d commit 3668c4b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tong-its.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,18 +1008,20 @@ async def main(state_info):
else:
winner = top_challengers[0][0]

# Print winner
if winner != -2:
server.players[winner].score += 1
print(f'{server.players[winner].name} won (id={winner})!\n')
else:
print('Nobody exposed a meld; nobody wins.\n')

# Send final gamestate
await send_gamestate(ret_val, server, winner)

# Display final gamestate
os.system('clear')
host_display(server)

# Print winner
if winner != -2:
server.players[winner].score += 1
print(f'{server.players[winner].name} won (id={winner})!\n')

# Ask host if they want to host again with same players
print('Rematch? Enter \'q\' to not rematch.')
choice = input('\n> ')
Expand Down

0 comments on commit 3668c4b

Please sign in to comment.