本文整理汇总了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());
}
}
示例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);
}
示例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);
}
示例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);
}
}