public boolean hasNeighbor(int piece, boolean withOpponents) {
		boolean condition = false;
		for (int dh = UP; dh <= DOWN; dh++) {
			for (int dv = LEFT; dv <= RIGHT; dv++) {
				if (dh == 0 && dv == 0)
					continue;
				int neighbor = searchNeighbor(piece, dh, dv);
				if (neighbor != -1) {
					condition = condition || (!withOpponents || (withOpponents && distance(piece, neighbor) >= 1));
				}
			}
		}
		return condition;
	}