private void UpdateBalancesAfterEvaluation(AiDealer dealer, HumanPlayer player, Winninghand winner) { switch (winner) { case Winninghand.Dealer: new DealerWins(player, dealer).UpdateBank(); break; case Winninghand.Player: case Winninghand.PlayerOnFake21: new PlayerWins(player, dealer).UpdateBank(); break; case Winninghand.Draw: case Winninghand.BothBust: new Draw(player, dealer).UpdateBank(); break; case Winninghand.PlayerOnNatural21: new PlayerWinsNatural21(player, dealer).UpdateBank(); break; default: break; } ResetBetsAndCurrentpot(dealer, player, (d, p) => { p.BetAmount = 0; d.BetAmount = 0; }); }
private void ResetBetsAndCurrentpot(AiDealer dealer, HumanPlayer player, params Action <IDealer, IPlayer>[] resetMethods) { for (int i = 0; i < resetMethods.Count(); i++) { resetMethods[i](dealer, player); } CurrentPot = 0; }
public BlackjackGame(AiDealer dealer, HumanPlayer player, int decksUsed) { Dealer = dealer.GuardNotNull(); DealerInfo = dealer.GuardNotNull(); MainPlayer = player.GuardNotNull(); DecksUsed = decksUsed; if (player.Balance > dealer.Balance) { throw new Exception("Dealer balance must be higher than player balance"); } else { GameRunning = true; AppRunning = true; } }