@staticmethod
def process_line(line):
    """
        Moves numbers inside a vector whether this vector represents
        a row or a column.

        .. runpython::
            :showcode:

            from ensae_teaching_cs.td_1a.cp2048 import Game2048
            print(Game2048.process_line([0, 2, 2, 4]))
        """
    res = []
    for n in line:
        if n == 0:
            continue
        if len(res) == 0:
            res.append(n)
        else:
            prev = res[-1]
            if prev == n:
                res[-1] = 2 * n
            else:
                res.append(n)
    while len(res) < len(line):
        res.append(0)
    return res
