private bool IsSameColor(IChessPiece piece, int x, int y) { if (!IsEmpty(x, y)) { if (GetPieceAtPosition(x, y).GetPieceColor() != piece.GetPieceColor()) { return(false); } } return(true); }