public bool DetectCheck() { foreach (Piece p in board.Pieces) { IMoveable piece = (IMoveable)p; King king = p.Color == enums.Color.LIGHT ? board.DarkKing : board.LightKing; if (piece.IsChecking(board, king)) { king.InCheck = true; return(true); } else { king.InCheck = false; }; } return(false); }