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; }
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; }
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'; }
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'; }
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; }