MCPcopy Index your code
hub / github.com/geekcomputers/Python / reset

Method reset

Snake Game Using Turtle/scoreboard.py:48–55  ·  view source on GitHub ↗

Checks for new high score, saves it, and resets the score.

(self)

Source from the content-addressed store, hash-verified

46 self.update_scoreboard()
47
48 def reset(self):
49 """Checks for new high score, saves it, and resets the score."""
50 if self.score > self.high_score:
51 self.high_score = self.score
52 with open("highscore.txt", mode="w") as file:
53 file.write(str(self.high_score))
54 self.score = 0
55 self.update_scoreboard()
56
57 def game_over(self):
58 """Displays the Game Over message and instructions."""

Callers

nothing calls this directly

Calls 1

update_scoreboardMethod · 0.95

Tested by

no test coverage detected