Add a white tile border to indicate the swap.
435747
def _draw_swap_cv(self, board_image, swap):
        """"""
        tile_h, tile_w = self._TILE_SHAPE[0:2]
        # get a single bounding box
        (row_1, col_1), (row_2, col_2) = swap
        t = tile_h * min(row_1, row_2)
        b = tile_h * (1 + max(row_1, row_2))
        l = tile_w * min(col_1, col_2)
        r = tile_w * (1 + max(col_1, col_2))
        top_left = (l, t)
        bottom_right = (r, b)
        data.cv2.rectangle(board_image, top_left, bottom_right,
                           color=(255, 255, 255), thickness = 4)
506131
def _add_tile(self, new_tile, ijk):
        
        tile_label = "{0}_{1}".format(self.name, '-'.join(str(d) for d in ijk))
        self.add(new_tile, label=tile_label, inherit_periodicity=False)
973226
function (color, width) {
        if (!color) {
            color = "red";
        }
        if (!width) {
            width = 2;
        }
        this.div.style.border = width + "px solid " + color;
    }
1165618
function addChildSpacing(wt) {
    var d = 0, modsumdelta = 0;                                    
    for (var i = 0; i < wt.num_children; i++) {                                  
      d += wt.children[i].shift;                                               
      modsumdelta += d + wt.children[i].change;                                
      wt.children[i].mod += modsumdelta;                                       
    }                                                                 
  }
233434
def add_tile(self, address, tile):
        

        if address in self._tiles:
            raise ArgumentError("Tried to add two tiles at the same address", address=address)

        self._tiles[address] = tile
894042
function setLeftTop(elem, offset, option) {
  // set position first, in-case top/left are set even on static elem
  if (css(elem, 'position') === 'static') {
    elem.style.position = 'relative';
  }
  var presetH = -999;
  var presetV = -999;
  var horizontalProperty = getOffsetDirection('left', option);
  var verticalProperty = getOffsetDirection('top', option);
  var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty);
  var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty);

  if (horizontalProperty !== 'left') {
    presetH = 999;
  }

  if (verticalProperty !== 'top') {
    presetV = 999;
  }
  var originalTransition = '';
  var originalOffset = getOffset(elem);
  if ('left' in offset || 'top' in offset) {
    originalTransition = Object(__WEBPACK_IMPORTED_MODULE_0__propertyUtils__["c" /* getTransitionProperty */])(elem) || '';
    Object(__WEBPACK_IMPORTED_MODULE_0__propertyUtils__["e" /* setTransitionProperty */])(elem, 'none');
  }
  if ('left' in offset) {
    elem.style[oppositeHorizontalProperty] = '';
    elem.style[horizontalProperty] = presetH + 'px';
  }
  if ('top' in offset) {
    elem.style[oppositeVerticalProperty] = '';
    elem.style[verticalProperty] = presetV + 'px';
  }
  // force relayout
  forceRelayout(elem);
  var old = getOffset(elem);
  var originalStyle = {};
  for (var key in offset) {
    if (offset.hasOwnProperty(key)) {
      var dir = getOffsetDirection(key, option);
      var preset = key === 'left' ? presetH : presetV;
      var off = originalOffset[key] - old[key];
      if (dir === key) {
        originalStyle[dir] = preset + off;
      } else {
        originalStyle[dir] = preset - off;
      }
    }
  }
  css(elem, originalStyle);
  // force relayout
  forceRelayout(elem);
  if ('left' in offset || 'top' in offset) {
    Object(__WEBPACK_IMPORTED_MODULE_0__propertyUtils__["e" /* setTransitionProperty */])(elem, originalTransition);
  }
  var ret = {};
  for (var _key in offset) {
    if (offset.hasOwnProperty(_key)) {
      var _dir = getOffsetDirection(_key, option);
      var _off = offset[_key] - originalOffset[_key];
      if (_key === _dir) {
        ret[_dir] = originalStyle[_dir] + _off;
      } else {
        ret[_dir] = originalStyle[_dir] - _off;
      }
    }
  }
  css(elem, ret);
}
412418
def _create_default_tiles(self):
        """"""
        for value, background, text in self.DEFAULT_TILES:
            self.tiles[value] = self._make_tile(value, background, text)
1361738
public Coordinate tileTopLeft(int tx, int ty, int zoomLevel) {
        int px = tx * tileSize;
        int py = ty * tileSize;
        Coordinate result = pixelsToMeters(px, py, zoomLevel);
        return result;
    }
625997
def color_square(self, x, y, unit_coords=False):
        
        # Calculate column and row number
        if unit_coords:
            col = x
            row = y
        else:
            col = x//self.col_width
            row = y//self.row_height

        # If the tile is not filled, create a rectangle
        if not self.tiles[row][col]:
            self.tiles[row][col] = \
                self.c.create_rectangle(col*self.col_width,
                                        row*self.row_height,
                                        (col+1)*self.col_width,
                                        (row+1)*self.row_height,
                                        fill="black")
            self.cells.append(row*self.cols + col)

        # If the tile is filled, delete the rectangle and clear the reference
        else:
            self.c.delete(self.tiles[row][col])
            self.tiles[row][col] = None
            self.cells.remove(row*self.cols + col)
1220904
def _update_stylesheet(self, widget):
        """"""
        if is_dark_interface():
            css = qdarkstyle.load_stylesheet_from_environment()
            widget.setStyleSheet(css)
            palette = widget.palette()
            background = palette.color(palette.Window).lighter(150).name()
            border = palette.color(palette.Window).lighter(200).name()
            name = widget.__class__.__name__
            widget.setObjectName(name)
            extra_css = '''
                {0}#{0} {{
                    background-color:{1};
                    border: 1px solid {2};
                }}'''.format(name, background, border)
            widget.setStyleSheet(css + extra_css)
713667
function switchBorderColor(editor, flag) {
        var tableArr = domUtils.getElementsByTagName(editor.body, "table"), color;
        for (var i = 0, node; node = tableArr[i++];) {
            var td = domUtils.getElementsByTagName(node, "td");
            if (td[0]) {
                if (flag) {
                    color = (td[0].style.borderColor).replace(/\s/g, "");
                    if (/(#ffffff)|(rgb\(255,255,255\))/ig.test(color))
                        domUtils.addClass(node, "noBorderTable")
                } else {
                    domUtils.removeClasses(node, "noBorderTable")
                }
            }

        }
    }
526434
function swapRowsInPlace (M, i, j) {
  const me = M.elements;
  let a1 = me[i];
  let a2 = me[i + 3];
  let a3 = me[i + 6];

  me[i] = me[j];
  me[i + 3] = me[j + 3];
  me[i + 6] = me[j + 6];

  me[j] = a1;
  me[j + 3] = a2;
  me[j + 6] = a3;
}
660140
async def add(ctx, left: int, right: int):
    """"""
    await ctx.send(left + right)
68703
def _shift_cells(self, get_cells, get_deltas):
        """"""
        # Don't do anything when there is an overlay.
        if self.lost or self.won == 1:
            return

        # A dictionary to store the movement of tiles, and new values if it merges.
        tile_moved = {}
        for y, row in enumerate(self.grid):
            for x, cell in enumerate(row):
                if cell:
                    tile_moved[x, y] = (None, None)

        # Store the old grid and score.
        old_grid = [row[:] for row in self.grid]
        old_score = self.score
        self.old.append((old_grid, self.score))
        if len(self.old) > 10:
            self.old.pop(0)

        moved = 0
        for row, column in get_cells():
            for dr, dc in get_deltas(row, column):
                # If the current tile is blank, but the candidate has value:
                if not self.grid[row][column] and self.grid[dr][dc]:
                    # Move the candidate to the current tile.
                    self.grid[row][column], self.grid[dr][dc] = self.grid[dr][dc], 0
                    moved += 1
                    tile_moved[dc, dr] = (column, row), None
                if self.grid[dr][dc]:
                    # If the candidate can merge with the current tile:
                    if self.grid[row][column] == self.grid[dr][dc]:
                        self.grid[row][column] *= 2
                        self.grid[dr][dc] = 0
                        self.score += self.grid[row][column]
                        self.won += self.grid[row][column] == self.WIN_TILE
                        tile_moved[dc, dr] = (column, row), self.grid[row][column]
                        moved += 1
                    # When hitting a tile we stop trying.
                    break

        # Submit the high score and get the change.
        delta = self.manager.got_score(self.score)
        free = self.free_cells()
        new_tiles = set()

        if moved:
            # Spawn new tiles if there are holes.
            if free:
                x, y = random.choice(free)
                value = self.grid[y][x] = random.randint(0, 10) and 2 or 4
                new_tiles.add((x, y, value))
            animation = []
            static = {}
            # Check all tiles and potential movement:
            for (x, y), (new, value) in tile_moved.items():
                # If not moved, store as static.
                if new is None:
                    static[x, y] = old_grid[y][x]
                else:
                    # Store the moving tile.
                    animation.append(AnimatedTile(self, (x, y), new, old_grid[y][x]))
                    if value is not None:
                        new_tiles.add(new + (value,))
            self.animate(animation, static, self.score - old_score, delta, new_tiles)
        else:
            self.old.pop()

        if not self.has_free_cells() and not self.has_free_moves():
            self.lost = True
911445
public void swap()
	{
		if (modeContext.equals(ModeContext.VIEW_MODE))
		{
			modeContext = ModeContext.EDIT_MODE;
		}
		else
		{
			modeContext = ModeContext.VIEW_MODE;
		}
	}
1000675
def _change(self, changes):
        
        if changes is None:
            return
        for position, new_tile in changes:
            self._array[position] = new_tile
541912
def addBorder(self, width, color=None):
		
		width = int(width/config.DOWNSAMPLING)
		if color==None:
			color = self.color
		layer = self.image.getActiveLayer().data
		colorRGBA = color.get_0_255()
		print('adding border'+str(colorRGBA)+str(width)+str(layer.shape))
		layer[0:width,:,0] = colorRGBA[0]
		layer[0:width,:,1] = colorRGBA[1]
		layer[0:width,:,2] = colorRGBA[2]
		layer[0:width,:,3] = colorRGBA[3]

		layer[:,0:width,0] = colorRGBA[0]
		layer[:,0:width,1] = colorRGBA[1]
		layer[:,0:width,2] = colorRGBA[2]
		layer[:,0:width,3] = colorRGBA[3]

		layer[layer.shape[0]-width:layer.shape[0],:,0] = colorRGBA[0]
		layer[layer.shape[0]-width:layer.shape[0],:,1] = colorRGBA[1]
		layer[layer.shape[0]-width:layer.shape[0],:,2] = colorRGBA[2]
		layer[layer.shape[0]-width:layer.shape[0],:,3] = colorRGBA[3]

		layer[:,layer.shape[1]-width:layer.shape[1],0] = colorRGBA[0]
		layer[:,layer.shape[1]-width:layer.shape[1],1] = colorRGBA[1]
		layer[:,layer.shape[1]-width:layer.shape[1],2] = colorRGBA[2]
		layer[:,layer.shape[1]-width:layer.shape[1],3] = colorRGBA[3]