예제 #1
0
        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());
            }

            BlackJack.view.MenuEvent.Event e;

            e = a_view.GetEvent();
            if (e == BlackJack.view.MenuEvent.Event.Quit)
            {
                return(false);
            }
            if (e == BlackJack.view.MenuEvent.Event.Start)
            {
                a_game.NewGame();
            }
            if (e == BlackJack.view.MenuEvent.Event.Hit)
            {
                a_game.Hit();
            }
            if (e == BlackJack.view.MenuEvent.Event.Stand)
            {
                a_game.Stand();
            }

            return(true);
        }
예제 #2
0
        public bool Play()
        {
            DisplayGame();

            view.Event e = m_view.GetEvent();

            switch (e)
            {
            case view.Event.Start:
                m_game.NewGame();
                break;

            case view.Event.Hit:
                m_game.Hit();
                break;

            case view.Event.Stand:
                m_game.Stand();
                break;

            case view.Event.Quit:
                return(false);
            }
            return(true);
        }
예제 #3
0
        public bool Play(model.Game a_game)
        {
            m_game = a_game;


            CardDealt();
            //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.Event e;
            e = a_view.GetEvent();

            if (e == view.Event.Play)
            {
                a_game.NewGame();
            }
            else if (e == view.Event.Hit)
            {
                a_game.Hit();
            }
            else if (e == view.Event.Stand)
            {
                a_game.Stand();
            }

            return(e != view.Event.Quit);
        }
예제 #4
0
        public bool Play()
        {
            PrintView();
            if (m_game.IsGameOver())
            {
                m_view.DisplayGameOver(m_game.IsDealerWinner());
            }

            BlackJack.view.MenuEvent.Event e;

            e = m_view.GetEvent();
            if (e == BlackJack.view.MenuEvent.Event.Quit)
            {
                return(false);
            }
            if (e == BlackJack.view.MenuEvent.Event.Start)
            {
                m_game.NewGame();
            }
            if (e == BlackJack.view.MenuEvent.Event.Hit)
            {
                m_game.Hit();
            }
            if (e == BlackJack.view.MenuEvent.Event.Stand)
            {
                m_game.Stand();
            }

            return(true);
        }