Fixed errors in scoreboard.
This commit is contained in:
parent
91f39aad88
commit
3b2bcd928d
@ -73,35 +73,35 @@ class Scoreboard:
|
||||
# Sort high scores by score value in descending order
|
||||
self.highScores.sort(key=lambda x: x['score'], reverse=True)
|
||||
|
||||
def getScore(self):
|
||||
def get_score(self):
|
||||
"""Get current score."""
|
||||
return self.currentScore
|
||||
|
||||
def getHighScores(self):
|
||||
def get_highScores(self):
|
||||
"""Get list of high scores."""
|
||||
return self.highScores
|
||||
|
||||
def decreaseScore(self, points=1):
|
||||
def decrease_score(self, points=1):
|
||||
"""Decrease the current score."""
|
||||
self.currentScore -= int(points)
|
||||
return self
|
||||
|
||||
def increaseScore(self, points=1):
|
||||
def increase_score(self, points=1):
|
||||
"""Increase the current score."""
|
||||
self.currentScore += int(points)
|
||||
return self
|
||||
|
||||
def setScore(self, score):
|
||||
def set_score(self, score):
|
||||
"""Set the current score to a specific value."""
|
||||
self.currentScore = int(score)
|
||||
return self
|
||||
|
||||
def resetScore(self):
|
||||
def reset_score(self):
|
||||
"""Reset the current score to zero."""
|
||||
self.currentScore = 0
|
||||
return self
|
||||
|
||||
def checkHighScore(self):
|
||||
def check_high_score(self):
|
||||
"""Check if current score qualifies as a high score.
|
||||
|
||||
Returns:
|
||||
@ -112,7 +112,7 @@ class Scoreboard:
|
||||
return i + 1
|
||||
return None
|
||||
|
||||
def addHighScore(self, name=None):
|
||||
def add_high_score(self, name=None):
|
||||
"""Add current score to high scores if it qualifies.
|
||||
|
||||
Args:
|
||||
@ -178,7 +178,7 @@ class Scoreboard:
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def hasHighScores():
|
||||
def has_high_scores():
|
||||
"""Check if the current game has any high scores.
|
||||
|
||||
Returns:
|
||||
@ -220,7 +220,7 @@ class Scoreboard:
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def displayHighScores():
|
||||
def display_high_scores():
|
||||
"""Display high scores for the current game.
|
||||
|
||||
Reads the high scores from Scoreboard class.
|
||||
|
Loading…
x
Reference in New Issue
Block a user