fix: GetOutCard 集成 — bot 出牌类型不再硬编码 DanZhang
根因: MakePlay 永远设 Type=DanZhang,bot 路径跳过 GetOutCard 校验, 导致多牌组合(对子/顺子等)被错误标为单张。 修复: - MakePlay: Type=DanZhang → Type=None(占位,等引擎赋值) - WaitWanJiaShuRu case4: bot 有Ids时通过 GetOutCard 获取正确牌型 - payCard.Pos 补设(GetOutCard 输出 Pos 默认为0) - ISMCTS 日志: 按 Ids 为空判断 pass,而非 Type 现在游戏日志正确显示: type:DanZhang/type:None/type:DuiZi 等
This commit is contained in:
@ -175,8 +175,9 @@ namespace PdkFriendServer.Logic
|
||||
candidates.Sort((a, b) => b.winRate.CompareTo(a.winRate));
|
||||
var best = candidates[0];
|
||||
|
||||
string desc = best.play.Type == CardType1.None ? "pass"
|
||||
: $"{best.play.Type}:{best.play.Ids?.Length ?? 0}c";
|
||||
string desc = best.play.Ids == null || best.play.Ids.Length == 0
|
||||
? "pass"
|
||||
: $"{best.play.Ids.Length}c";
|
||||
Console.WriteLine($"[ISMCTS pos{view.MyPos}] {simsPerCandidate * candidates.Count}sims "
|
||||
+ $"winRate:{best.winRate:P0} => {desc}");
|
||||
|
||||
@ -356,7 +357,7 @@ namespace PdkFriendServer.Logic
|
||||
{
|
||||
Pos = (byte)pos, GameNum = cards[0].GameNum,
|
||||
Ids = cards.Select(x => x.ID).ToArray(),
|
||||
Type = CardType1.DanZhang
|
||||
Type = CardType1.None // 不给假类型,让引擎GetOutCard赋予真值
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -690,7 +690,22 @@ namespace PdkFriendServer.Logic
|
||||
{
|
||||
var view = BuildBotView(pos);
|
||||
var botPlay = _bots[pos - 1].DecidePlay(view);
|
||||
GamePack.Info.ActivePlayCard = botPlay;
|
||||
// 非pass(有Ids)则运行 GetOutCard 获取正确牌型,pass(Type=None且Ids为空)直接设
|
||||
if (botPlay.Ids != null && botPlay.Ids.Length > 0)
|
||||
{
|
||||
var hand = view.MyHand;
|
||||
var selectCards = hand.Where(c => botPlay.Ids.Contains(c.ID)).ToArray();
|
||||
if (selectCards.Length > 0)
|
||||
{
|
||||
PdkCardAlgorithm.GetOutCard(selectCards, hand, Rule, out var payCard);
|
||||
payCard.Pos = (byte)pos;
|
||||
GamePack.Info.ActivePlayCard = payCard;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GamePack.Info.ActivePlayCard = botPlay;
|
||||
}
|
||||
return;
|
||||
}
|
||||
// 人工输入
|
||||
|
||||
Reference in New Issue
Block a user