public object TryCalUse( [KouPluginArgument(Name = "使用数字,比如1,2,3,4", SplitChar = ",, 、", ArgumentAttributes = KouEnum.KouParameterAttribute.AllowDuplicate)] List <int> useNumList) { if (useNumList.Count > 5) { return("最多只能算5个数"); } TwentyFour a = new TwentyFour(); string answerStr = null; List <string> answers = null; var success = All ? a.TryCalUse(Target, useNumList, out answers) : a.TryTest(Target, useNumList, out answerStr); if (!success) { return($"我算了{a.CalCount}次,也没能算出答案呢..."); } if (answers != null) { answerStr = answers.ToStringJoin('\n').TrimEnd('\n'); } answerStr = All ? $"总共有如下{answers?.Count}个答案:{answerStr}" : $"中的一个解:{answerStr}"; return($"使用[{useNumList.ToStringJoin(',')}]计算{Target}点{answerStr}"); }
public object TryTest( [KouPluginArgument(Name = "使用的数字,比如1,2,3,4", SplitChar = ",, 、", ArgumentAttributes = KouEnum.KouParameterAttribute.AllowDuplicate)] List <int> useNumList) { if (useNumList.Count > 5) { return("最多只能算5个数"); } TwentyFour a = new TwentyFour(); if (!a.TryTest(Target, useNumList, out var answers)) { return($"我算了{a.CalCount}次,也没能算出答案呢..."); } return($"使用[{useNumList.ToStringJoin(',')}]计算{Target}点发现了答案噢"); }