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


C# Deck.Deal方法代码示例

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


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

示例1: Deal_ShouldProvideCards_WhileDeckIsNotEmpty

 public void Deal_ShouldProvideCards_WhileDeckIsNotEmpty(Deck deck)
 {
     while (!deck.IsEmpty)
     {
         Assert.IsType<Card>(deck.Deal());
     }
 }
开发者ID:yakimovim,项目名称:Cards,代码行数:7,代码来源:DeckTests.cs

示例2: Deck_Deal_Test

        public void Deck_Deal_Test()
        {
            // Arrange
            var deck = new Deck();
            var hand = new Hand();
            var card1 = deck.Cards[0];
            var card2 = deck.Cards[1];

            // Act
            deck.Deal(hand);

            // Assert
            Assert.AreEqual(card1, hand.Cards[0]);
            Assert.AreEqual(card2, hand.Cards[1]);
            Assert.AreEqual(50, deck.Cards.Count);
            Assert.IsFalse(deck.Cards.Contains(card1));
            Assert.IsFalse(deck.Cards.Contains(card2));

            deck.Populate();
            Assert.AreEqual(52, deck.Cards.Count);
        }
开发者ID:makalainspire,项目名称:Programming,代码行数:21,代码来源:DeckTest.cs

示例3: StartGame

        public void StartGame(Deck deck)
        {
            Deck = deck;
            Deck.Shuffle();
            CurrentCard = Deck.Deal();
            PreviewCard = Deck.Deal();

            Elapsed = 0;
            Progress = 1;
            IsPlaying = true;
            StartedAt = DateTime.Now;
            _dispatcher.PublishMessage(MessageType.StartGame);
        }
开发者ID:WaltValentine,项目名称:KVL,代码行数:13,代码来源:GameManager.cs

示例4: DealButtonClick

        private void DealButtonClick(object sender, EventArgs e)
        {
            PlayerBlackjackHand.AllowUnnaturalSplits = allowUnnaturalSplitsCheckBox.Checked;
            deck = new Shoe((int)deckNumericUpDown.Value);
            deck.PerfectShuffle();

            dealerHand = new DealerBlackjackHand();
            playerHands = new List<PlayerBlackjackHand>();
            PlayerBlackjackHand hand = new PlayerBlackjackHand(betAmountNumericUpDown.Value);
            playerHands.Add(hand);
            handInPlay = 0;

            hand.Hit(deck.Deal(true));
            dealerHand.Hit(deck.Deal(false));
            hand.Hit(deck.Deal(true));
            dealerHand.Hit(deck.Deal(true));

            // Shut down the dealing area for now,
            //	until end of hand:
            bankGroupBox.Enabled = false;
            configurationGroupBox.Enabled = false;
            resultsLabel.Text = "";

            // Show hands:
            dealerHandPanel.Hand = dealerHand;
            SetPlayerHands();

            // Configure controls for the current hand:
            if (playerHands[handInPlay].IsBlackjack) {
                standButton.Enabled = true;
                standButton.PerformClick();
            } else {
                // Check for dealer blackjack:
                if (dealerHand.IsBlackjack) handInPlay = 1;
                ConfigureControls(handInPlay);
            }
        }
开发者ID:channguyen,项目名称:blackjack-windows-form,代码行数:37,代码来源:FormGame.cs


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