canMerge method

bool canMerge(
  1. VectorDefinition start,
  2. CellMergeDirection direction,
  3. int span
)

Implementation

bool canMerge(
  VectorDefinition start,
  CellMergeDirection direction,
  int span,
) {
  var current = start;
  for (var i = 0; i < span; i++) {
    if (!containsCell(current)) return false;
    current = direction == CellMergeDirection.horizontal
        ? VectorDefinition(current.x + 1, current.y)
        : VectorDefinition(current.x, current.y + 1);
  }
  return true;
}