• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CardSuit类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Bid

        public Bid(int tricks, CardSuit? trump)
            : this(BidType.Tricks)
        {
            if ((tricks < 6) || (tricks > 10))
                throw new ArgumentOutOfRangeException("tricks");

            mTricks = tricks;
            mTrump = trump;
        }
开发者ID:DVorobyev,项目名称:Preference,代码行数:9,代码来源:Bid.cs


示例17: CreateCard

 private Card CreateCard(int value, CardSuit suit, CardType type)
 {
     return new Card()
     {
         Value = value,
         Suit = suit,
         Type = type
     };
 }
开发者ID:Adamsons,项目名称:21,代码行数:9,代码来源:Deck.cs


示例18: Card

 protected Card(Game game, int id, CardType type, CardSuit suit, CardRank rank)
 {
     this.game = game;
     this.id = id;
     this.type = type;
     this.suit = suit;
     this.rank = rank;
     color = GetColor(type);
     empty = new EmptyCard(this);
 }
开发者ID:sciaopin,项目名称:bang-sharp,代码行数:10,代码来源:Card.cs


示例19: PlayingCardWidget

 public PlayingCardWidget(int id, CardType type, CardRank rank, CardSuit suit)
 {
     layout = new Pango.Layout(Gdk.PangoHelper.ContextGet());
     layout.FontDescription = Pango.FontDescription.FromString("Angleterre Book, Librarian bold 32");
     this.id = id;
     this.type = type;
     this.rank = rank;
     this.suit = suit;
     Card = CardManager.GetCard(type);
     UpdateMarkup();
 }
开发者ID:sciaopin,项目名称:bang-sharp,代码行数:11,代码来源:PlayingCardWidget.cs


示例20: EqualsShouldWorkCorrectly

 public void EqualsShouldWorkCorrectly(
     bool expectedValue,
     CardSuit firstCardSuit,
     CardType firstCardType,
     CardSuit secondCardSuit,
     CardType secondCardType)
 {
     var firstCard = new Card(firstCardSuit, firstCardType);
     var secondCard = new Card(secondCardSuit, secondCardType);
     Assert.AreEqual(expectedValue, firstCard.Equals(secondCard));
     Assert.AreEqual(expectedValue, secondCard.Equals(firstCard));
 }
开发者ID:GoranGit,项目名称:TexasHoldemGameEngine,代码行数:12,代码来源:CardTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CardType类代码示例发布时间:2022-05-24
下一篇:
C# CardState类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap