From 6d2c6e04d8253c91151a7da59bdb0905e56a91b8 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Fri, 14 Feb 2025 20:46:38 -0500 Subject: [PATCH] Fixed a bug with score sorting. --- __init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/__init__.py b/__init__.py index 09fecae..5ab1a20 100755 --- a/__init__.py +++ b/__init__.py @@ -61,12 +61,12 @@ class Scoreboard: read_config() self.currentScore = score self.highScores = [] - + try: localConfig.add_section("scoreboard") except: pass - + # Load existing high scores for i in range(1, 11): try: @@ -81,6 +81,9 @@ class Scoreboard: 'name': "Player", 'score': 0 }) + + # Sort high scores by score value in descending order + self.highScores.sort(key=lambda x: x['score'], reverse=True) def get_score(self): """Get current score."""