From ae93e02e69e4718d6411a4c1b6bdfec8cf3beb18 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 30 Aug 2020 01:41:52 -0400 Subject: [PATCH] Another approach to writing the scoreboard. --- libstormgames.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libstormgames.py b/libstormgames.py index 3ce68ba..e542d16 100755 --- a/libstormgames.py +++ b/libstormgames.py @@ -83,11 +83,10 @@ class scoreboard(): # Update the scores for i, j in enumerate(self.oldScores): if self.score > j: - # Move the old high score down the list - if i < 9: - self.oldScores[i + 1] = j - self.oldScores[i] = self.score + self.oldScores.insert(i, self.score) break + # Only keep the top 10 scores. + self.oldScores = self.oldScores[:10] # Update the scoreboard section of the games config file. for i, j in enumerate(self.oldScores): localConfig.set("scoreboard", str(i + 1), str(j))