Exemple #1
0
        public PlayGame(model.Game a_game, view.IView a_view)
        {
            this.a_game = a_game;
            this.m_view = a_view;

            a_game.AddSubscriber(this);
        }
        public bool Play()
        {
            if (subcriberNeeded)
            {
                m_game.AddSubscriber(this);
                subcriberNeeded = false;
            }

            m_view.DisplayWelcomeMessage();

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

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

            view.GameOption input = m_view.GetInput();

            if (input == view.GameOption.Play)
            {
                m_game.NewGame();
            }
            else if (input == view.GameOption.Hit)
            {
                m_game.Hit();
            }
            else if (input == view.GameOption.Stand)
            {
                m_game.Stand();
            }

            return(input != view.GameOption.Quit);
        }
        public PlayGame(model.Game a_game, view.IView a_view)
        {
            m_game = a_game;
            m_view = a_view;

            //subscribe to game events
            m_game.AddSubscriber(this);

            UpdateView();
        }
Exemple #4
0
        public PlayGame()
        {
            // create a setup controller
            SetupGame setup = new SetupGame();

            // create a game with config delivered from the setup controller
            m_game = new model.Game(setup.GetWinnerAtDrawRules(), setup.GetDealer17Rules(), setup.GetGameRules());
            // Let setup controller create the game view depending on language
            m_view = setup.GetLanguageView();

            m_game.AddSubscriber(this);
        }
Exemple #5
0
        public PlayGame()
        {
            // create a setup controller
            SetupGame setup = new SetupGame();

            // create a game with config delivered from the setup controller
            m_game = new model.Game(setup.GetWinnerAtDrawRules(), setup.GetDealer17Rules(), setup.GetGameRules());
            // Let setup controller create the game view depending on language
            m_view = setup.GetLanguageView();

            m_game.AddSubscriber(this);
        }
        public PlayGame(model.Game a_game, view.IView a_view)
        {
            m_game = a_game;
            m_view = a_view;

            //subscribe to game events
            m_game.AddSubscriber(this);

            if (!(m_view is view.ModernView))
            {
                ClearView();
            }
        }
Exemple #7
0
 public PlayGame(model.Game a_game, view.IView a_view)
 {
     this.a_game = a_game;
     this.a_view = a_view;
     a_game.AddSubscriber(this);
 }
 public PlayGame(model.Game g, IView v)
 {
     m_game = g;
     m_view = v;
     m_game.AddSubscriber(this);
 }
Exemple #9
0
 public PlayGame(view.IView m_view, model.Game a_game)
 {
     a_view = m_view;
     a_game.AddSubscriber(this);
 }
Exemple #10
0
 public PlayGame(view.IView a_view, model.Game a_game)
 {
     m_view = a_view;
     m_game = a_game;
     a_game.AddSubscriber(this);
 }