def compact_pieces
recheck = false
for i in (0..@width-1)
for j in (0..@height-1)
if @board[i][j] and @board[i][j+1].nil? #drop pieces down
recheck = true
@board[i][j+1] = @board[i][j]
@board[i][j] = nil
elsif j == 0 and @board[i][j].nil? #replace pieces at top
recheck = true
@board[i][j] = Piece.new("gem")
end
end
end
#sleep(0.3) <- doesn't work, all pauses come at once
#draw
if recheck
compact_pieces
clear_matches
end
end