Skip to content

Commit

Permalink
Make sure scores are tuples.
Browse files Browse the repository at this point in the history
  • Loading branch information
amtoine committed Jul 10, 2021
1 parent 4eafee7 commit 3afd2c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def main(stdscr):
game_debug_msg = new_debug_msg if new_debug_msg else game_debug_msg
elif game_state == game.LOST:
game_state = game.WAITING
data = [game_score, datetime.now().strftime("%d/%m/%Y %H:%M:%S"), user_name]
data = (game_score, datetime.now().strftime("%d/%m/%Y %H:%M:%S"), user_name)
game_scores.append(';'.join(map(str, data)))

# blit all the objects on the screen.
Expand Down
3 changes: 2 additions & 1 deletion src/score.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def main():
print("reading scores", end="... ")
with open(".scores.csv", 'r') as file:
lines = file.readlines()
data = list(map(lambda s: s.strip().split(';'), lines)) # score have following format: '<score>;<date>;<username>'.
# score have following format: '<score>;<date>;<username>'.
data = list(map(lambda s: tuple(s.strip().split(';')), lines))

# do NOT continue if not a single game has been completed.
if len(data) == 0:
Expand Down

0 comments on commit 3afd2c0

Please sign in to comment.