litris fixes
This commit is contained in:
6
field.py
6
field.py
@@ -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):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user