Skip to content

Commit 927c5e5

Browse files
committed
linting 2048.py
1 parent 670ed38 commit 927c5e5

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

Projects/2048/2048.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
file.close()
4545
high_score = init_high
4646

47+
4748
# draw game over and restart text
4849
def draw_over():
4950
pygame.draw.rect(screen, "black", [50, 50, 300, 100], 0, 10)
@@ -76,12 +77,18 @@ def draw_pieces(board):
7677
color = colors[value]
7778
else:
7879
color = color["other"]
79-
pygame.draw.rect(screen, color, [j * 95 + 20, i * 95 + 20, 75, 75], 0, 5)
80+
pygame.draw.rect(
81+
screen, color, [j * 95 + 20, i * 95 + 20, 75, 75], 0, 5
82+
)
8083
if value > 0:
8184
value_len = len(str(value))
82-
font = pygame.font.Font("freesansbold.ttf", 48 - (5 * value_len))
85+
font = pygame.font.Font(
86+
"freesansbold.ttf", 48 - (5 * value_len)
87+
)
8388
value_text = font.render(str(value), True, value_color)
84-
text_rect = value_text.get_rect(center=(j * 95 + 57, i * 95 + 57))
89+
text_rect = value_text.get_rect(
90+
center=(j * 95 + 57, i * 95 + 57)
91+
)
8592
screen.blit(value_text, text_rect)
8693
pygame.draw.rect(
8794
screen, "black", [j * 95 + 20, i * 95 + 20, 75, 75], 2, 5
@@ -93,7 +100,8 @@ def draw_pieces(board):
93100
def is_game_over(board):
94101
for i in range(3):
95102
for j in range(3):
96-
if board[i][j] == board[i + 1][j] or board[i][j] == board[i][j + 1]:
103+
if (board[i][j] == board[i + 1][j] or
104+
board[i][j] == board[i][j + 1]):
97105
return False
98106

99107
for j in range(3):
@@ -103,7 +111,7 @@ def is_game_over(board):
103111
for i in range(3):
104112
if board[i][3] == board[i + 1][3]:
105113
return False
106-
## if there's no valid move left, the game is over
114+
# if there's no valid move left, the game is over
107115
return True
108116

109117

0 commit comments

Comments
 (0)