Another approach to writing the scoreboard.
This commit is contained in:
parent
21c0795ea9
commit
ae93e02e69
@ -83,11 +83,10 @@ class scoreboard():
|
|||||||
# Update the scores
|
# Update the scores
|
||||||
for i, j in enumerate(self.oldScores):
|
for i, j in enumerate(self.oldScores):
|
||||||
if self.score > j:
|
if self.score > j:
|
||||||
# Move the old high score down the list
|
self.oldScores.insert(i, self.score)
|
||||||
if i < 9:
|
|
||||||
self.oldScores[i + 1] = j
|
|
||||||
self.oldScores[i] = self.score
|
|
||||||
break
|
break
|
||||||
|
# Only keep the top 10 scores.
|
||||||
|
self.oldScores = self.oldScores[:10]
|
||||||
# Update the scoreboard section of the games config file.
|
# Update the scoreboard section of the games config file.
|
||||||
for i, j in enumerate(self.oldScores):
|
for i, j in enumerate(self.oldScores):
|
||||||
localConfig.set("scoreboard", str(i + 1), str(j))
|
localConfig.set("scoreboard", str(i + 1), str(j))
|
||||||
|
Loading…
Reference in New Issue
Block a user