private boolean isCheck(PlayerPiece king, boolean isWhite) {
        int opp = (isWhite ? BLACK : WHITE);
        for (PlayerPiece p : playersPieces.get(opp)) {
            int r1 = p.getRow();
            int c1 = p.getCol();
            int r2 = king.getRow();
            int c2 = king.getCol();

            boolean isValidMove = false;
            switch (p.getPiece()) {
                case PAWN:
                    isValidMove = isValidMovePawn(r1, c1, r2, c2, isWhite);
                    break;
                case ROOK:
                    isValidMove = isValidMoveRook(r1, c1, r2, c2);
                    break;
                case BISCHOP:
                    isValidMove = isValidMoveBischop(r1, c1, r2, c2);
                    break;
                case QUEEN:
                    isValidMove = isValidMoveQueen(r1, c1, r2, c2);
                    break;
                case KING:
                    isValidMove = false;
                    break;
                case KNIGHT:
                    isValidMove = isValidMoveKnight(r1, c1, r2, c2);
                    break;
            }

            if (isValidMove) {
                return true;
            }
        }

        return false;
    }