當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。