public bool Play(model.Game a_game, view.IView a_view) { a_game.AddSubscriberToPlayer(this); 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()); } model.MenuChoice choice = a_view.GetMenuChoice(); if (choice == model.MenuChoice.NewGame) { a_game.NewGame(); } else if (choice == model.MenuChoice.Hit) { a_game.Hit(); } else if (choice == model.MenuChoice.Stand) { a_game.Stand(); } return(choice != model.MenuChoice.Quit); }
public bool Play() { DisplayGame(); if (a_game.IsGameOver()) { a_view.DisplayGameOver(a_game.IsDealerWinner()); } EnumChoice.GameChoice input = a_view.GetInput(); if (input == EnumChoice.GameChoice.Play) { a_game.m_player.RegisterSubscriber(this); a_game.m_dealer.RegisterSubscriber(this); a_game.NewGame(); } else if (input == EnumChoice.GameChoice.Hit) { a_game.Hit(); } else if (input == EnumChoice.GameChoice.Stand) { a_game.Stand(); } // return(input != EnumChoice.GameChoice.Quit); }
public bool Play() { DisplayAllScreen(); if (m_game.IsGameOver()) { m_view.DisplayGameOver(m_game.IsDealerWinner()); } m_view.GetInput(); if (m_view.WantsNewGame()) { m_game.NewGame(); } else if (m_view.WantsToHit()) { m_game.Hit(); } else if (m_view.WantsToStand()) { m_game.Stand(); } return(!m_view.WantsToQuit()); }
public bool Play() { GetPlayBoard(); if (_game.IsGameOver()) { _view.DisplayGameOver(_game.IsDealerWinner()); } view.PlayerAction input = _view.GetMenuOption(); if (input == view.PlayerAction.DoPlay) { _game.NewGame(); } else if (input == view.PlayerAction.DoHit) { _game.Hit(); } else if (input == view.PlayerAction.DoStand) { _game.Stand(); } return(input != view.PlayerAction.DoQuit); }
public bool Play() { DisplayCard(); if (m_game.IsGameOver()) { m_view.DisplayGameOver(m_game.IsDealerWinner()); } view.Input input = m_view.GetInput(); if (input == view.Input.Play) { m_game.NewGame(); } else if (input == view.Input.Hit) { m_game.Hit(); } else if (input == view.Input.Stand) { m_game.Stand(); } return(input != view.Input.Quit); }
public bool Play() { view.DisplayWelcomeMessage(); view.DisplayDealerHand(game.GetDealerHand(), game.GetDealerScore()); view.DisplayPlayerHand(game.GetPlayerHand(), game.GetPlayerScore()); if (game.IsGameOver()) { game.m_player.ClearSubscriber(); game.m_dealer.ClearSubscriber(); view.DisplayGameOver(game.IsDealerWinner()); } input = view.GetInput(); if (input == 'p') { game.m_player.AddSubscriber(this); game.m_dealer.AddSubscriber(this); game.NewGame(); } else if (input == 'h') { game.Hit(); } else if (input == 's') { game.Stand(); } return(input != 'q'); }
public bool Play() { RenderGame(); if (m_game.IsGameOver()) { m_view.DisplayGameOver(m_game.IsDealerWinner()); } switch (m_view.GetMenuChoice()) { case MenuChoices.PlayGame: m_game.NewGame(); break; case MenuChoices.Hit: m_game.Hit(); break; case MenuChoices.Stay: m_game.Stand(); break; case MenuChoices.Quit: return(false); } return(true); }
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 bool Play() { UpdateCards(); if (a_game.IsGameOver()) { a_view.DisplayGameOver(a_game.IsDealerWinner()); } view.MenuOptions input = a_view.GetInput(); if (input == view.MenuOptions.Play) { a_game.NewGame(); } else if (input == view.MenuOptions.Hit) { a_game.Hit(); } else if (input == view.MenuOptions.Stand) { a_game.Stand(); } return(input != view.MenuOptions.Quit); }
public bool Play() { 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()); } Event input = m_view.GetInput(); switch (input) { case Event.Play: m_game.NewGame(); break; case Event.Hit: m_game.Hit(); break; case Event.Stand: m_game.Stand(); break; } return(input != Event.Quit); }
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); }
public bool Play() { DisplayWelcomeMessageAndHands(); if (m_game.IsGameOver()) { m_view.DisplayGameOver(m_game.IsDealerWinner()); } ViewAction action = m_view.GetAction(); if (action == ViewAction.Newgame) { m_game.NewGame(); } else if (action == ViewAction.Hit) { m_game.Hit(); } else if (action == ViewAction.Stand) { m_game.Stand(); } return(action != ViewAction.Quit); }
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); }
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); }
public bool Play(model.Game a_game, view.IView a_view) { m_view = a_view; m_game = a_game; m_view.DisplayWelcomeMessage(); m_game.AddSubToPlayer(this); 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.MenuOptions input = m_view.GetInput(); if (view.MenuOptions.PLAY.Equals(input)) { m_game.NewGame(); } else if (view.MenuOptions.HIT.Equals(input)) { m_game.Hit(); } else if (view.MenuOptions.STAND.Equals(input)) { m_game.Stand(); } return(!view.MenuOptions.QUIT.Equals(input)); }
public bool Play() { 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.Alternatives input = (view.Alternatives)m_view.GetInput(); switch (input) { case view.Alternatives.play: m_game.NewGame(); break; case view.Alternatives.hit: m_game.Hit(); break; case view.Alternatives.stand: m_game.Stand(); break; default: break; } return(input != view.Alternatives.quit); }
public bool Play() { this.DisplayCards(); if (m_game.IsGameOver()) { m_view.DisplayGameOver(m_game.IsDealerWinner()); } char input = m_view.GetInput(); if (input == m_inputLetter.getPlay()) { m_game.NewGame(); } else if (input == m_inputLetter.getHit()) { m_game.Hit(); } else if (input == m_inputLetter.getStand()) { m_game.Stand(); } return(input != m_inputLetter.getQuit()); }
public bool Play(model.Game a_game, view.IView a_view) { this.a_game = a_game; this.a_view = a_view; a_view.SetGame(a_game); DisplayMessages(a_game, a_view); if (a_game.IsGameOver()) { a_view.DisplayGameOver(a_game.IsDealerWinner()); } int input = a_view.GetInput(); if (input == a_view.WantToPlay()) { a_game.NewGame(); } else if (input == a_view.WantToHit()) { a_game.Hit(); //Escape early. If the player got over 21 then he lost, or atleast should initialize the gameover screen. Might want to work on this if (a_game.IsGameOver()) { a_view.DisplayGameOver(a_game.IsDealerWinner()); return(input != a_view.WantToQuit()); } } else if (input == a_view.WantToStand()) { a_game.Stand(); } return(input != a_view.WantToQuit()); }
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()); } view.MenuSelection input = a_view.GetInput(); if (input == view.MenuSelection.Play) { a_game.NewGame(); } else if (input == view.MenuSelection.Hit) { a_game.Hit(); } else if (input == view.MenuSelection.Stand) { a_game.Stand(); } return(input != view.MenuSelection.Quit); }
public bool Play(model.Game a_game, view.IView a_view) { this.m_view = a_view; this.m_view.DisplayWelcomeMessage(); this.m_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore()); this.m_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore()); if (a_game.IsGameOver()) { this.m_view.DisplayGameOver(a_game.IsDealerWinner()); } int input = this.m_view.GetInput(); if (input == BlackJack.view.SwedishView.Play) { a_game.NewGame(); } else if (input == BlackJack.view.SwedishView.Hit) { a_game.Hit(); } else if (input == BlackJack.view.SwedishView.Stand) { a_game.Stand(); } return(input != BlackJack.view.SwedishView.Quit); }
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); }
public bool Play(model.Game a_game, view.IView a_view) { m_game = a_game; m_view = 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 == (int)GameAlternative.Play) { a_game.NewGame(); } else if (input == (int)GameAlternative.Hit) { a_game.Hit(); } else if (input == (int)GameAlternative.Stand) { a_game.Stand(); } return(input != (int)GameAlternative.Quit); }
public bool Play() { m_game.Subscribe(this); DealtCard(); if (m_game.IsGameOver()) { m_view.DisplayGameOver(m_game.IsDealerWinner()); } Input input = m_view.GetInput(); switch (input) { case Input.Play: m_game.NewGame(); break; case Input.Hit: m_game.Hit(); break; case Input.Stand: m_game.Stand(); break; } return(input != Input.Quit);; }
public bool Play() { 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 (a_view.IsPlay(input)) { a_game.NewGame(); } else if (a_view.IsHit(input)) { a_game.Hit(); } else if (a_view.IsStand(input)) { a_game.Stand(); } return(!a_view.IsQuit(input)); }
public bool Play() { 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.InputEvents input = a_view.GetInput(); if (input == view.InputEvents.NewGame) { a_game.NewGame(); } else if (input == view.InputEvents.Hit) { a_game.Hit(); } else if (input == view.InputEvents.Stand) { a_game.Stand(); } return(input != view.InputEvents.Quit); }
public bool Play(model.Game a_game, view.IView a_view, DealtCardObserver observer) { a_game.RegisterObserver(observer); if (!GameStarted) { a_view.DisplayWelcomeMessage(); } if (a_game.IsGameOver()) { a_view.DisplayGameOver(a_game.IsDealerWinner()); } UserWish userWish = a_view.GetUserWish(); if (userWish == UserWish.Play) { GameStarted = true; a_game.NewGame(); } if (userWish == UserWish.Hit) { a_game.Hit(); } if (userWish == UserWish.Stand) { a_game.Stand(); } return(userWish != UserWish.Quit); }
public bool Play(model.Game a_game, view.IView a_view) { a_game.RegisterNewCardDealer(this); this.game = a_game; this.view = a_view; CardDisplayer(); if (a_game.IsGameOver()) { a_view.DisplayGameOver(a_game.IsDealerWinner()); } int input = a_view.GetInput(); switch (input) { case 1: { a_game.NewGame(); break; } case 2: { a_game.Hit(); break; } case 3: { a_game.Stand(); break; } case 4: { return(input != 4); } } return(input != 4); }
public bool Play() { if (game.IsGameOver()) { view.DisplayGameOver(game.IsDealerWinner()); } view.SetInputOption(); if (view.doesUserWantToPlay()) { game.NewGame(); } else if (view.doesUserWantToHit()) { game.Hit(); } else if (view.doesUserWantToStand()) { game.Stand(); } else if (view.doesUserWantToQuit()) { return(false); } return(true); }
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(); Observer pause = new Observer(); pause.PauseIt(); } else if (input == 's') { a_game.Stand(); } return(input != 'q'); }
public bool GetInput(model.Game a_game) { 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'); }