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() { if (a_game.IsGameOver()) { CardDrawn(); a_view.DisplayGameOver(a_game.IsDealerWinner()); } var input = a_view.GetInput(); switch (input) { case view.Event.Play: a_game.NewGame(); break; case view.Event.Hit: a_game.Hit(); break; case view.Event.Stand: a_game.Stand(); break; case view.Event.Quit: return(false); case view.Event.None: return(true); } 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(model.Game a_game, view.IView a_view) { m_game = a_game; m_view = a_view; m_game.RegisterNewObserver(this); update(); if (a_game.IsGameOver()) { m_view.DisplayGameOver(a_game.IsDealerWinner()); } int input = m_view.GetInput(); if (input == view.SwedishView.NewGame_c) { a_game.NewGame(); } else if (input == view.SwedishView.Hit_c) { a_game.Hit(); } else if (input == view.SwedishView.Stand_c) { a_game.Stand(); } return(input != view.SwedishView.Quit_c); }
public bool Play() { DisplayInfo(); if (m_game.IsGameOver()) { m_view.DisplayGameOver(m_game.IsDealerWinner()); } Event input = m_view.GetInput(); if (input == Event.Play) { m_game.NewGame(); } else if (input == Event.Hit) { m_game.Hit(); } else if (input == Event.Stand) { m_game.Stand(); } return(input != Event.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() { 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(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 (a_view.PlayerWantsToPlay(input)) { a_game.NewGame(); } else if (a_view.PlayerWantsToHit(input)) { a_game.Hit(); } else if (a_view.PlayerWantsToStand(input)) { a_game.Stand(); } return(a_view.PlayerWantsToQuit(input)); }
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 == 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() { 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() { 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() { bool keepPlaying = true; 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()); } Enum input = a_view.GetInput(); if (input != null) { switch (input) { case ViewEnums.Play: a_game.NewGame(); break; case ViewEnums.Hit: a_game.Hit(); break; case ViewEnums.Stand: a_game.Stand(); break; case ViewEnums.Quit: keepPlaying = false; break; default: break; } } return(keepPlaying); }
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() { 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(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(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() { 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(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(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() { 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) { 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) { 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 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()) { foreach (model.Player obs in a_game.getPlayers()) { obs.removeObserver(this); } a_view.DisplayGameOver(a_game.IsDealerWinner()); } switch (a_view.GetInput()) { case view.MenuOptions.play: foreach (model.Player obs in a_game.getPlayers()) { obs.addObserver(this); } a_game.NewGame(); break; case view.MenuOptions.hit: a_game.Hit(); break; case view.MenuOptions.stand: a_game.Stand(); break; case view.MenuOptions.quit: return(false); default: return(true); } return(true); }
public bool Play() { RenderGame(); view.UserChoice input = c_view.GetInput(); if (view.UserChoice.PLAY.Equals(input)) { c_game.NewGame(); } else if (view.UserChoice.HIT.Equals(input)) { c_game.Hit(); } else if (view.UserChoice.STAND.Equals(input)) { c_game.Stand(); } return(!view.UserChoice.QUIT.Equals(input)); }
public bool Play() { m_game.AddSubscriber(this); ShowHands(); if (m_game.IsGameOver()) { m_view.DisplayGameOver(m_game.IsDealerWinner()); } view.Input input = m_view.GetInput(); switch (input) { case view.Input.StartNewGame: m_game.NewGame(); break; case view.Input.Stand: m_game.Stand(); break; case view.Input.Hit: m_game.Hit(); break; case view.Input.Quit: return(false); case view.Input.None: break; default: break; } return(true); }
public bool Play() { view.PlayChoice input = a_view.GetInput(); if (input == view.PlayChoice.Play) { a_game.NewGame(); } else if (input == view.PlayChoice.Hit) { a_game.Hit(); } else if (input == view.PlayChoice.Stand) { a_game.Stand(); if (a_game.IsGameOver()) { a_view.DisplayGameOver(a_game.IsDealerWinner()); } } return(input != view.PlayChoice.Quit); }
public bool Play() { return(m_view.GetInput(m_game)); }