private bool IsCheck(PlayerColor player) { Piece prince = _chessboard.GetPrince(player); // If prince is alive there is no check if (prince.Cell != null) { return(false); } var opponentPlayerAvailableCells = new List <Cell>(); foreach (Piece piece in _chessboard.Board) { // If piece is opponent's piece if (piece != null && piece.Color != player) { opponentPlayerAvailableCells.AddRange(piece.GetAvailableCells()); } } Piece king = _chessboard.GetKing(player); return(opponentPlayerAvailableCells.Contains(king.Cell)); }