mirror of
https://github.com/kristoferssolo/2048.git
synced 2026-03-22 00:26:26 +00:00
feat(game): display score
This commit is contained in:
@@ -74,7 +74,7 @@ class Game2048:
|
|||||||
def move_down(self) -> None:
|
def move_down(self) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def merge(self, row: np.ndarray) -> bool:
|
def merge(self) -> bool:
|
||||||
done = False
|
done = False
|
||||||
for row in range(self.size):
|
for row in range(self.size):
|
||||||
for col in range(self.size - 1, 0, -1):
|
for col in range(self.size - 1, 0, -1):
|
||||||
@@ -90,6 +90,7 @@ class Game2048:
|
|||||||
return done
|
return done
|
||||||
|
|
||||||
def display(self) -> None:
|
def display(self) -> None:
|
||||||
|
print(f"Score: {self.score}")
|
||||||
for row in self.board:
|
for row in self.board:
|
||||||
for val in row:
|
for val in row:
|
||||||
print(f"{val:^3}", end="")
|
print(f"{val:^3}", end="")
|
||||||
|
|||||||
Reference in New Issue
Block a user