From 461c27e2d3a4ab44adc6b0887357fa0314d6ae46 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Mon, 1 Jan 2024 20:24:36 +0200 Subject: [PATCH] feat(game): add `restart` method --- src/py2048/board.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/py2048/board.py b/src/py2048/board.py index b8654f0..2856717 100644 --- a/src/py2048/board.py +++ b/src/py2048/board.py @@ -82,3 +82,8 @@ class Board(pygame.sprite.Group): def is_game_over(self) -> bool: """Check if the game is over.""" return self._is_full() and not self._can_move() + + def restart(self) -> None: + """Restart the game.""" + self.empty() + self.generate_initial_blocks()