finished grid update implementation

This commit is contained in:
Jack Case
2025-08-23 22:03:00 -04:00
parent 42e027f7f0
commit b1957841b3

13
grid.gd
View File

@@ -102,12 +102,15 @@ func update_grid():
set_token(temp_col[idx], rows - temp_col.size() + idx, col) set_token(temp_col[idx], rows - temp_col.size() + idx, col)
# search for empty columns and compact horizontally # search for empty columns and compact horizontally
var empty_columns = [] var temp_grid = grid.filter(func(col: Array): return !col.all(func(token): return token == null))
for col in range(cols):
if grid[col].all(func(token): return token == null):
empty_columns.append(col)
print(empty_columns) var arr = []
arr.resize(rows)
arr.fill(null)
for _i in range(cols - temp_grid.size()):
temp_grid.append(arr)
grid = temp_grid
redraw_grid() redraw_grid()