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


C# CardSuit类代码示例

本文整理汇总了C#中CardSuit的典型用法代码示例。如果您正苦于以下问题:C# CardSuit类的具体用法?C# CardSuit怎么用?C# CardSuit使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Card

 /// <summary>
 /// Initializes a new instance of the Card class.
 /// </summary>
 /// <param name="CardType">Type of card to create.</param>
 /// <param name="CardSuit">Suit of card to create.</param>
 public Card(CardType CardType, CardSuit CardSuit)
 {
     m_Suit = CardSuit;
     m_Type = CardType;
     m_InternalValue = (int)CardType;
     m_IsHigh = true;
 }
开发者ID:SpectralCoding,项目名称:blackjack,代码行数:12,代码来源:Card.cs

示例2: Card

 public Card(CardSuit suit, CardValue value, Image front, Image back)
 {
     Suit = suit;
     Value = value;
     FrontFace = front;
     BackFace = back;
 }
开发者ID:RedHobbit,项目名称:ClockPatience,代码行数:7,代码来源:Card.cs

示例3: CardValueTest

        public void CardValueTest(CardValue value1, CardSuit suit1, CardValue value2, CardSuit suit2, int expected)
        {
            Card card1 = new Card(value1, suit1);
            Card card2 = new Card(value2, suit2);

            Assert.AreEqual(expected, card1.CompareTo(card2));
        }
开发者ID:vermeeca,项目名称:Katas,代码行数:7,代码来源:CardTests.cs

示例4: GetOpponentCards

        public ICollection<Card> GetOpponentCards(ICollection<Card> myCards, ICollection<Card> playedCards, Card activeTrumpCard, CardSuit suit)
        {
            var playerCards = new CardCollection
                                  {
                                      new Card(suit, CardType.Nine),
                                      new Card(suit, CardType.Jack),
                                      new Card(suit, CardType.Queen),
                                      new Card(suit, CardType.King),
                                      new Card(suit, CardType.Ten),
                                      new Card(suit, CardType.Ace),
                                  };

            foreach (var card in myCards.Where(x => x.Suit == suit))
            {
                playerCards.Remove(card);
            }

            foreach (var card in playedCards.Where(x => x.Suit == suit))
            {
                playerCards.Remove(card);
            }

            if (activeTrumpCard != null)
            {
                playerCards.Remove(activeTrumpCard);
            }

            return playerCards;
        }
开发者ID:NotDemons,项目名称:NotDemonsRepo,代码行数:29,代码来源:OpponentSuitCardsProvider.cs

示例5:

 // Обращение к карте по ее типу и масти
 public Card this[CardType type, CardSuit suit]
 {
     get
     {
         return list.Find(c => (c.Type == type) && (c.Suit == suit));
     }
 }
开发者ID:TawaSystems,项目名称:belotetest,代码行数:8,代码来源:CardList.cs

示例6: Bonus

 // Метод создания бонуса - ему присваиваются тип, младшая карта, а также опционно для бонусов типа "последовательность" - масть
 public Bonus(BonusType Type, CardType HighCard, bool IsTrump, CardSuit Suit = CardSuit.C_NONE)
 {
     this.Type = Type;
     this.HighCard = HighCard;
     this.Suit = Suit;
     this.IsTrump = IsTrump;
 }
开发者ID:TawaSystems,项目名称:belotetest,代码行数:8,代码来源:Bonus.cs

示例7: GetCardWithSuitThatEnemyDoesNotHave

        public Card GetCardWithSuitThatEnemyDoesNotHave(bool enemyHasATrumpCard, CardSuit trumpSuit, ICollection<Card> playerCards)
        {
            if (!enemyHasATrumpCard)
            {
                // In case the enemy does not have any trump cards and Stalker has a trump, he should throw a trump.
                var myTrumpCards = playerCards.Where(c => c.Suit == trumpSuit).ToList();
                if (myTrumpCards.Count() > 0)
                {
                    return myTrumpCards.OrderBy(c => c.GetValue()).LastOrDefault();
                }
            }

            var orderedCards = playerCards.OrderBy(c => c.GetValue());
            foreach (var card in orderedCards)
            {
                if (this.cardHolder.EnemyCards.All(c => c.Suit != card.Suit))
                {
                    if (enemyHasATrumpCard)
                    {
                        return playerCards.Where(c => c.Suit == card.Suit).OrderBy(c => c.GetValue()).FirstOrDefault();
                    }

                    return playerCards.Where(c => c.Suit == card.Suit).OrderByDescending(c => c.GetValue()).FirstOrDefault();
                }
            }

            return null;
        }
开发者ID:M-Yankov,项目名称:S.T.A.L.K.E.R,代码行数:28,代码来源:StalkerHelper.cs

示例8: Order

 public Order(OrderType Type, int Size, CardSuit Trump)
 {
     this.Type = Type;
     this.Size = Size;
     this.Trump = Trump;
     this.Team = BeloteTeam.TEAM_NONE;
 }
开发者ID:TawaSystems,项目名称:belotetest,代码行数:7,代码来源:Order.cs

示例9: hasSuit

 /// <summary>
 /// checks the hand if it has the passed suit or not
 /// </summary>
 /// <param name="suit">Suit of the card to check.</param>
 /// <param name="hand">Hand of the player to check in.</param>
 /// <returns></returns>
 public static bool hasSuit(CardSuit suit, Hand hand)
 {
     foreach (SpadesCard card in hand.CardPile)
     {
         if (Card.SuitFromCardIndex(card.CardIndex) == suit) return true;
     }
     return false;
 }
开发者ID:nishesj,项目名称:callbreak,代码行数:14,代码来源:GameRule.cs

示例10: Card

 public Card( int rank, CardSuit suit, CardOrientation orientation = CardOrientation.FaceDown )
 {
     if ( rank < (int)CardRank.Ace || rank > (int)CardRank.King )
      {
     throw new ArgumentException( "Invalid card rank" );
      }
      InitCard( (CardRank) rank, suit, orientation );
 }
开发者ID:arudnitsky,项目名称:Solitaire,代码行数:8,代码来源:Card.cs

示例11: GetFailureProbabilityForSuit

        private double GetFailureProbabilityForSuit(int cards, int discards, CardSuit suit)
        {
            int cardSet = BitwiseCardHelper.GetCardSet(cards, suit);
            int discardsCount = BitwiseCardHelper.GetSuitCount(discards, suit);
            int otherSuitsDistribution = CardSuitDistribution.GetDistribution(cards, discards, suit);

            return MisereProbabilities.GetFailureProbability(cardSet, discardsCount, otherSuitsDistribution, IsFirstHand);
        }
开发者ID:DVorobyev,项目名称:Preference,代码行数:8,代码来源:MisereEvaluator.cs

示例12: Of

 public static ICard Of(CardSuit cardSuit)
 {
     var king = new King
     {
         _CardSuit = cardSuit
     };
     return king;
 }
开发者ID:tekavec,项目名称:WarGameKata,代码行数:8,代码来源:King.cs

示例13: Of

 public static ICard Of(CardSuit cardSuit)
 {
     var jack = new Jack
     {
         _CardSuit = cardSuit
     };
     return jack;
 }
开发者ID:tekavec,项目名称:WarGameKata,代码行数:8,代码来源:Jack.cs

示例14: Card

 public Card(CardSuit suit, CardRank rank, Image frontImage) : this(suit, rank)
 {
     this.FrontImage = frontImage;
     //Can we make it to private readonly or const?
     this.BackCardPath = "..\\..\\Resources\\Cards\\Back.png";
     this.BackImage = Image.FromFile(BackCardPath);
     this.CardPictureBox = new PictureBox();
 }
开发者ID:MiBuena,项目名称:HighQualityProject,代码行数:8,代码来源:Card.cs

示例15: ChangeTrumpCardTest

        public void ChangeTrumpCardTest(CardSuit suit, CardType type)
        {
            var newCard = new Card(suit, type);
            var deck = new Deck();

            deck.ChangeTrumpCard(newCard);

            Assert.AreNotEqual(0, deck.CardsLeft, "Change card doesn't work");
        }
开发者ID:deyantodorov,项目名称:TelerikAcademy,代码行数:9,代码来源:DeckTests.cs


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