public bool IsCheckFor(Board board, ChessColor color) { var kingLocation = board.GetKingLocation(color); var opponentColor = color.GetOpposite(); var opponentPiecesLocations = board.GetPiecesLocations(opponentColor); var kingCanBeTakeByOpponentPiece = opponentPiecesLocations .Any(pieceLoc => CanPieceTakeAtLocation(board, pieceLoc.Location, kingLocation)); return(kingCanBeTakeByOpponentPiece); }
public void SwitchViewPerspective() { viewPerspective = viewPerspective.GetOpposite(); }