litris fixes

This commit is contained in:
2023-07-24 11:15:11 +02:00
parent a21f43fcfc
commit f35fe32264
2 changed files with 35 additions and 13 deletions

View File

@@ -13,7 +13,8 @@ class Field():
else:
self.state = [[' ' for cols in range(Field.WIDTH)]
for rows in range(Field.HEIGHT)]
self.cleared_rows = 0
self.rotate_90_degree_clckwise(self.state)
self.cleared_rows = 1
def __str__(self):
BAR = ' ' + '-' * (Field.WIDTH * 2 + 1) + '\n ' + \
@@ -22,7 +23,7 @@ class Field():
'{:2d} |'.format(i) + ' '.join(row) + '|'
for i, row in enumerate(self.state)]) + '\n' + BAR
def rotate_90_degree_clckwise(matrix):
def rotate_90_degree_clckwise(self, matrix):
new_matrix = []
for i in range(len(matrix[0])):
li = list(map(lambda x: x[i], matrix))
@@ -98,6 +99,7 @@ class Field():
while len(self.state) < Field.HEIGHT:
self.state.insert(0, [' ' for col in range(Field.WIDTH)])
self.cleared_rows = self.cleared_rows + 1
print("cleared rows: ", self.cleared_rows)
def copy(self):
"""