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


C# Dealer.AddCard方法代码示例

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


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

示例1: Test5CardsUnder21Win

        public void Test5CardsUnder21Win()
        {
            Player player = new Player();
            Deck deck = new Deck();
            Dealer dealer = new Dealer();
            player.AddCard(new Card(Rank.TWO, Suit.DIAMOND));
            player.AddCard(new Card(Rank.TWO, Suit.SPADE));
            player.AddCard(new Card(Rank.ACE, Suit.SPADE));
            player.AddCard(new Card(Rank.FOUR, Suit.SPADE));
            player.AddCard(new Card(Rank.ACE, Suit.HEART));

            dealer.AddCard(new Card(Rank.TEN, Suit.HEART));
            dealer.AddCard(new Card(Rank.TEN, Suit.SPADE));

            BlackJackGame game = new BlackJackGame(deck, player, dealer);
            game.CheckScores();
            Assert.IsTrue(game.Status == GameState.WIN);
        }
开发者ID:Calneideck,项目名称:Blackjack,代码行数:18,代码来源:TestCard.cs

示例2: TestBetLose

        public void TestBetLose()
        {
            Player player = new Player();
            Deck deck = new Deck();
            Dealer dealer = new Dealer();

            BlackJackGame game = new BlackJackGame(deck, player, dealer);

            player.AddCard(new Card(Rank.TEN, Suit.DIAMOND));
            player.AddCard(new Card(Rank.FOUR, Suit.SPADE));

            dealer.AddCard(new Card(Rank.TEN, Suit.HEART));
            dealer.AddCard(new Card(Rank.EIGHT, Suit.SPADE));

            game.Decision = true;
            game.CheckScores();
            game.RestartGame ();

            Assert.IsTrue(game.Player.Money == 80);
        }
开发者ID:Calneideck,项目名称:Blackjack,代码行数:20,代码来源:TestBetting.cs

示例3: TestWin21

        public void TestWin21()
        {
            Player player = new Player();
            Deck deck = new Deck();
            Dealer dealer = new Dealer();

            BlackJackGame game = new BlackJackGame(deck, player, dealer);

            dealer.AddCard(new Card(Rank.TEN, Suit.HEART));
            dealer.AddCard(new Card(Rank.EIGHT, Suit.SPADE));

            player.AddCard(new Card(Rank.ACE, Suit.DIAMOND));
            player.AddCard(new Card(Rank.JACK, Suit.SPADE));

            game.CheckScores();
            game.RestartGame();
            Assert.AreEqual(105, game.Player.Money);
        }
开发者ID:Calneideck,项目名称:Blackjack,代码行数:18,代码来源:TestBetting.cs

示例4: TestDealer17

 public void TestDealer17()
 {
     Deck deck = new Deck();
     Dealer dealer = new Dealer();
     dealer.AddCard(new Card(Rank.KING, Suit.HEART));
     dealer.AddCard(new Card(Rank.SEVEN, Suit.CLUB));
     dealer.Deal(deck);
     Assert.IsTrue (dealer.CardsinHand == 2);
 }
开发者ID:Calneideck,项目名称:Blackjack,代码行数:9,代码来源:TestCard.cs

示例5: TestWin

        public void TestWin()
        {
            Player player = new Player();
            Dealer dealer = new Dealer();
            Deck deck = new Deck();
            player.AddCard(new Card(Rank.TEN, Suit.DIAMOND));
            player.AddCard(new Card(Rank.TEN, Suit.SPADE));

            dealer.AddCard(new Card(Rank.TEN, Suit.CLUB));
            dealer.AddCard(new Card(Rank.NINE, Suit.SPADE));

            BlackJackGame game = new BlackJackGame(deck, player, dealer);
            game.Decision = true;
            game.CheckScores();

            Assert.IsTrue(game.Status == GameState.WIN);
        }
开发者ID:Calneideck,项目名称:Blackjack,代码行数:17,代码来源:TestCard.cs


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