diff options
Diffstat (limited to 'cameltris.py')
-rwxr-xr-x | cameltris.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cameltris.py b/cameltris.py index 60f8aee..1246b4e 100755 --- a/cameltris.py +++ b/cameltris.py @@ -175,6 +175,18 @@ def generate_piece(): return (piece, [initial_y_position, initial_x_position]) +def burn_rows(): + rows_to_burn = list() + + for row in grid: + if all(map(lambda element: element is not None, row)): + rows_to_burn.append(row) + + for row in rows_to_burn: + grid.insert(0, [None for _ in range(10)]) + grid.remove(row) + + def stick_piece(): global current_piece, current_piece_position @@ -184,6 +196,7 @@ def stick_piece(): continue grid[row_id + current_piece_position[0]][col_id + current_piece_position[1]] = element + burn_rows() current_piece, current_piece_position = generate_piece() pygame.init() |