diff --git a/PdkFriendServer/Logic/IsmctsBot.cs b/PdkFriendServer/Logic/IsmctsBot.cs index dc2e0f6a..a62e209c 100644 --- a/PdkFriendServer/Logic/IsmctsBot.cs +++ b/PdkFriendServer/Logic/IsmctsBot.cs @@ -438,7 +438,7 @@ namespace PdkFriendServer.Logic if (curTips != null && curTips.Count > 0) { - var pick = PickBestTip(curTips); + var pick = PickBestTip(curTips, curHand, false); maxPlay = new PlayOutCardPdkF { Pos = (byte)current, GameNum = pick[0].GameNum, Type = pick.Count == 1 ? CardType1.DanZhang : CardType1.DuiZi, Ids = pick.Select(c => c.ID).ToArray() }; maxPlayer = current; passStreak = 0; foreach (var id in maxPlay.Ids) curHand.RemoveAll(c => c.ID == id); @@ -450,7 +450,7 @@ namespace PdkFriendServer.Logic var ft = PdkCardAlgorithm.GetTipCard(new PlayOutCardPdkF(), curHand.ToArray(), null, false); if (ft != null && ft.Count > 0) { - var pick = PickBestTip(ft); + var pick = PickBestTip(ft, curHand, true); maxPlay = new PlayOutCardPdkF { Pos = (byte)current, GameNum = pick[0].GameNum, Type = CardType1.DanZhang, Ids = pick.Select(c => c.ID).ToArray() }; maxPlayer = current; foreach (var id in maxPlay.Ids) curHand.RemoveAll(c => c.ID == id); @@ -576,17 +576,43 @@ namespace PdkFriendServer.Logic return runs; } - private static List PickBestTip(List> tips) + /// + /// 智能出牌选择:模拟中的虚拟对手应该合理出牌,而非纯贪心。 + /// - 跟牌时:出刚好能压制的最小牌(保留大牌) + /// - 领牌时:优先多牌组合(提高清牌效率) + /// + private static List PickBestTip(List> tips, + List curHand, bool isNewRound) { if (tips == null || tips.Count == 0) return null; - var best = tips[tips.Count - 1]; - int bestScore = best.Count * 10 + best[0].GameNum; - for (int i = tips.Count - 2; i >= 0; i--) + + if (!isNewRound) { - int s = tips[i].Count * 10 + tips[i][0].GameNum; - if (s > bestScore) { bestScore = s; best = tips[i]; } + // 跟牌:出刚好能压制的最小牌 + // 策略:出最小 rank 的有效牌,保留大牌用于后续压制 + var best = tips[0]; + int bestScore = int.MaxValue; + foreach (var tip in tips) + { + // 同数量优先选最小 rank;不同数量优先选少的 + int score = tip.Count * 1000 + tip[0].GameNum; + if (score < bestScore) { bestScore = score; best = tip; } + } + return best; + } + else + { + // 领牌:优先高效清牌 + var best = tips[0]; + int bestScore = int.MinValue; + foreach (var tip in tips) + { + // 优先多牌;同数量出最小 rank(保留大牌控制权) + int score = tip.Count * 100 - tip[0].GameNum; + if (score > bestScore) { bestScore = score; best = tip; } + } + return best; } - return best; } // 静态牌池:52张牌,只创建一次 diff --git a/exe/PdkFriendServer/PdkFriendServer.dll b/exe/PdkFriendServer/PdkFriendServer.dll index 5d0ddc92..85625179 100644 Binary files a/exe/PdkFriendServer/PdkFriendServer.dll and b/exe/PdkFriendServer/PdkFriendServer.dll differ diff --git a/exe/PdkFriendServer/PdkFriendServer.pdb b/exe/PdkFriendServer/PdkFriendServer.pdb index 0985d439..5d383c66 100644 Binary files a/exe/PdkFriendServer/PdkFriendServer.pdb and b/exe/PdkFriendServer/PdkFriendServer.pdb differ diff --git a/exe/hjha-console/PdkFriendServer.dll b/exe/hjha-console/PdkFriendServer.dll index 5d0ddc92..85625179 100644 Binary files a/exe/hjha-console/PdkFriendServer.dll and b/exe/hjha-console/PdkFriendServer.dll differ diff --git a/exe/hjha-console/PdkFriendServer.pdb b/exe/hjha-console/PdkFriendServer.pdb index 0985d439..5d383c66 100644 Binary files a/exe/hjha-console/PdkFriendServer.pdb and b/exe/hjha-console/PdkFriendServer.pdb differ