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


C# model.Hit方法代码示例

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


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

示例1: Play

        public bool Play(model.Game a_game, view.IView a_view)
        {
            m_view = a_view;
            m_game = a_game;
            a_view.DisplayWelcomeMessage();

            a_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
            a_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());

            if (a_game.IsGameOver())
            {
                a_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            BlackJack.view.Events input = (BlackJack.view.Events)a_view.GetInput();

            if (input == view.Events.Play)
            {
                a_game.NewGame();
            }
            else if (input == view.Events.Hit)
            {
                a_game.Hit();
            }
            else if (input == view.Events.Stand)
            {
                a_game.Stand();
            }

            return input != view.Events.Quit;
        }
开发者ID:jt222ii,项目名称:Workshop3Blackjack,代码行数:31,代码来源:PlayGame.cs

示例2: Play

        public bool Play(model.Game a_game, view.IView a_view)
        {
            //Initialize fields
            m_view = a_view;
            m_game = a_game;

            a_view.DisplayWelcomeMessage();

            a_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
            a_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());

            if (a_game.IsGameOver())
            {
                a_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            view.Input input = a_view.GetInput();

            if (input == view.Input.Play)
            {
                a_game.NewGame();
            }
            else if (input == view.Input.Hit)
            {
                a_game.Hit();
            }
            else if (input == view.Input.Stand)
            {
                a_game.Stand();
            }

            return input != view.Input.Quit;
        }
开发者ID:kk222hk,项目名称:1dv607-kk222hk-Portfolio,代码行数:33,代码来源:PlayGame.cs

示例3: Play

        public bool Play(model.Game a_game)
        {
            //a_game.AddSubscriber(this);
            m_view.DisplayWelcomeMessage();

               // m_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
            //m_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());//

            if (a_game.IsGameOver())
            {
                m_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            model.Game.Status input = m_view.GetInput();

            if (input == model.Game.Status.NewGame)
            {
                a_game.NewGame();
            }
            else if (input == model.Game.Status.Hit)
            {
                a_game.Hit();
            }
            else if (input == model.Game.Status.Stand)
            {
                a_game.Stand();
            }

            return input != model.Game.Status.Quit;
        }
开发者ID:henceee,项目名称:1DV607,代码行数:30,代码来源:PlayGame.cs

示例4: Play

        public bool Play(model.Game a_game, view.IView a_view)
        {
            a_view.DisplayWelcomeMessage();

            a_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
            a_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());

            if (a_game.IsGameOver())
            {
                a_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            int input = a_view.GetInput();

            if (input == 'p')
            {
                a_game.NewGame();
            }
            else if (input == 'h')
            {
                a_game.Hit();
            }
            else if (input == 's')
            {
                a_game.Stand();
            }

            return input != 'q';
        }
开发者ID:kk222hk,项目名称:blackjack_csharp,代码行数:29,代码来源:PlayGame.cs

示例5: PlayGame

        public bool PlayGame(view.Console a_view, model.GameFacade a_game)
        {
            a_view.PresentInstructions();
            a_view.DisplayHands(a_game.GetDealerHand(), a_game.GetDealerScore(), a_game.GetPlayerHand(), a_game.GetPlayerScore());
            if (a_game.IsGameOver())
            {
                a_view.DisplayWinner(a_game.IsPlayerWinner());
            }

            view.Console.Event e;

            e = a_view.GetEvent();
            if (e == view.Console.Event.Quit)
            {
                return false;
            }
            if (e == view.Console.Event.Start)
            {
                a_game.StartNewRound();

            }
            if (e == view.Console.Event.Hit)
            {
                a_game.Hit();
            }
            if (e == view.Console.Event.Stand)
            {
                a_game.Stand();
            }

            return true;
        }
开发者ID:tobias-dv-lnu,项目名称:1dv607_2015,代码行数:32,代码来源:Player.cs

示例6: Play

 public bool Play(model.Game a_game)
 {            
     m_view.DisplayWelcomeMessage();
     if (a_game.GetPlayerScore() != 0)
     {
         m_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
         m_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());
     }
     if (a_game.IsGameOver())
     {
         m_view.DisplayGameOver(a_game.IsDealerWinner());
     }
     gameAction input = m_view.GetInput();
     if (input == gameAction.play)
     {
         m_view.DisplayWelcomeMessage();
         var test = a_game.NewGame();
     }
     else if (input == gameAction.hit)
     {
         a_game.Hit();
     }
     else if (input == gameAction.stand)
     {
         a_game.Stand();
     }
     return input != gameAction.quit;
 }
开发者ID:DevRobDev,项目名称:1DV407,代码行数:28,代码来源:PlayGame.cs

示例7: Play

        public bool Play(model.Game a_game, view.IView a_view)
        {
            a_view.DisplayWelcomeMessage();
            a_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
            a_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());

            if (a_game.IsGameOver())
            {
                a_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            //int input = a_view.GetInput(); removed due to hidden depencendy.
            int input = System.Console.In.Read();

            if (input == 'p')
            {
                a_game.NewGame();
            }
            else if (input == 'h')
            {
                a_game.Hit();
            }
            else if (input == 's')
            {
                a_game.Stand();
            }

            return input != 'q';
        }
开发者ID:henceee,项目名称:1DV607,代码行数:29,代码来源:PlayGame.cs

示例8: Play

        public bool Play(model.Game a_game)
        {
            m_view.DisplayWelcomeMessage();

            m_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
            m_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());

            if (a_game.IsGameOver())
            {
                m_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            switch((view.Choices)m_view.GetInput())
            {
                case view.Choices.Play:
                    a_game.NewGame();
                    break;
                case view.Choices.Hit:
                    a_game.Hit();
                    break;
                case view.Choices.Stand:
                    a_game.Stand();
                    break;
                case view.Choices.Quit:
                    return false;

                default:
                    break;
            }

            return true;
        }
开发者ID:fr222cy,项目名称:IDV607-Black-Jack,代码行数:32,代码来源:PlayGame.cs

示例9: Play

        public bool Play(model.Game a_game, view.IView a_view)
        {
            m_view = a_view;
            m_game = a_game;


            if (!isWelcomed)
            {
                isWelcomed = true;
                a_view.DisplayWelcomeMessage();
                m_view.DisplayRules(m_game.GetHitRule(), m_game.GetNewGameRule(), m_game.GetWinRule());
            }
            else { 
                a_view.DisplayResults(a_game.GetPlayerHand(), a_game.GetPlayerScore(), a_game.GetDealerHand(), a_game.GetDealerScore());
            }

            if (a_game.IsGameOver())
            {
                a_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            view.Action action = a_view.GetInput();

            switch (action)
            {
                case view.Action.NewGame:
                    a_game.NewGame();
                    break;
                case view.Action.Hit:
                    a_game.Hit();
                    break;
                case view.Action.Stand:
                    a_game.Stand();
                    break;
            }

            return action != view.Action.Quit;

        }
开发者ID:kristofferlind,项目名称:1dv407-ooad,代码行数:39,代码来源:PlayGame.cs


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