private boolean pathToOtherGroupExists(Board board, Set<Cell> blackGroup, Cell tabooCell) {
    // "flood fill" starting from one of the blackCells
    final Cell startCell = blackGroup.iterator().next();
    final Set<Cell> seen = new CellSet(board);
    final List<Cell> todo = new ArrayList<>();
    todo.add(startCell);
    while (!todo.isEmpty()) {
      final Cell current = todo.remove(todo.size() - 1);
      if (!seen.add(current)) {
        // already done
        continue;
      }
      for (final Cell neighbor : board.getNeighborsSet(current)) {
        if (neighbor.isBlack() && !blackGroup.contains(neighbor)) {
          // we found a path to another black group
          return true;
        }
        else if (!neighbor.isWhite() && !neighbor.equals(tabooCell)) {
          todo.add(neighbor);
        }
      }
    }
    // nothing found
    return false;
  }