当前位置: 首页>>代码示例>>C#>>正文


C# Card.IsTrump方法代码示例

本文整理汇总了C#中Santase.Logic.Cards.Card.IsTrump方法的典型用法代码示例。如果您正苦于以下问题:C# Card.IsTrump方法的具体用法?C# Card.IsTrump怎么用?C# Card.IsTrump使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Santase.Logic.Cards.Card的用法示例。


在下文中一共展示了Card.IsTrump方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Compute

        public static void Compute(Node root, Card oppCard, IList<Card> myCards, IList<Card> oppCards, int myPoints, int oppPoints)
        {
            if (myPoints >= 66)
            {
                root.Wins++;
                root.Total++;

                return;
            }

            if (oppPoints >= 66)
            {
                root.Total++;

                return;
            }

            if (oppCard == null)
            {
                for (int i = 0; i < 6; i++)
                {
                    if (myCards[i] == null)
                    {
                        continue;
                    }

                    var myNextCard = myCards[i];
                    myCards[i] = null;

                    var root1 = new Node(root, myNextCard, true);

                    var myValue = myNextCard.GetValue();

                    for (int j = 0; j < 6; j++)
                    {
                        if (oppCards[j] == null)
                        {
                            continue;
                        }

                        var nextOppCard = oppCards[j];
                        oppCards[j] = null;

                        var oppValue = nextOppCard.GetValue();

                        if ((nextOppCard.HasSameSuitAs(myNextCard) && oppValue > myValue) || (!oppCards.Any(x => x!= null && x.Suit == myNextCard.Suit) && nextOppCard.IsTrump()))
                        {
                            var root2 = new Node(root1, nextOppCard, false);

                            for (int k = 0; k < 6; k++)
                            {
                                if (oppCards[k] == null)
                                {
                                    continue;
                                }

                                var oppCard3 = oppCards[k];
                                oppCards[k] = null;

                                var root3 = new Node(root2, oppCard3, false);

                                Compute(root3, oppCard3, myCards, oppCards, myPoints, oppPoints + myValue + oppValue);

                                root2.Children.Add(root3);
                                root2.Wins += root3.Wins;
                                root2.Total += root3.Total;

                                oppCards[k] = oppCard3;
                            }

                            root1.Children.Add(root2);
                            root1.Wins += root2.Wins;
                            root1.Total += root2.Total;
                        }
                        else
                        {
                            var root2 = new Node(root1, nextOppCard, true);

                            Compute(root2, null, myCards, oppCards, myPoints + myValue + oppValue, oppPoints);

                            root1.Children.Add(root2);
                            root1.Wins += root2.Wins;
                            root1.Total += root2.Total;
                        }

                        oppCards[j] = nextOppCard;
                    }

                    root.Children.Add(root1);
                    root.Wins += root1.Wins;
                    root.Total += root1.Total;

                    myCards[i] = myNextCard;
                }
            }
            else
            {
                for (int i = 0; i < 6; i++)
                {
                    if (myCards[i] == null)
//.........这里部分代码省略.........
开发者ID:KonstantinSimeonov,项目名称:Zatvoreno,代码行数:101,代码来源:EndgameAnalyzer.cs


注:本文中的Santase.Logic.Cards.Card.IsTrump方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。