code: def __collapseLineOrCol(self, line, d):
          
          if (d == Board.LEFT or d == Board.UP):
              inc = 1
              rg = xrange(0, self.__size-1, inc)
          else:
              inc = -1
              rg = xrange(self.__size-1, 0, inc)
  
          pts = 0
          for i in rg:
              if line[i] == 0:
                  continue
              if line[i] == line[i+inc]:
                  v = line[i]*2
                  if v == self.__goal:
                      self.__won = True
  
                  line[i] = v
                  line[i+inc] = 0
                  pts += v
  
          return (line, pts)
docs: Merge tiles in a line or column according to a direction and return a
          tuple with the new line and the score for the move on this line