Beispiel #1
0
        private bool CheckNaturalBlackJack(Player _player, Player _dealer)
        {
            Console.WriteLine();
            if (_dealer.IsNaturalBlackJack && _player.IsNaturalBlackJack)
            {
                Console.WriteLine("Player and Dealer got natural BlackJack. Tie Game!");
                _dealer.ShowUpCards();
                return(true);
            }
            else if (_dealer.IsNaturalBlackJack && !_player.IsNaturalBlackJack)
            {
                Console.WriteLine($"{_dealer.Name} got natural BlackJack. {_dealer.Name} won!");
                _dealer.ShowUpCards();
                _player.ChipsOnHand -= (int)Math.Floor(_player.ChipsOnBet * 1.5);
                return(true);
            }
            else if (!_dealer.IsNaturalBlackJack && _player.IsNaturalBlackJack)
            {
                Console.WriteLine($"{_player.Name} got natural BlackJack. {_player.Name} won!");
                _player.AddWinCount();
                _player.ChipsOnHand += (int)Math.Floor(_player.ChipsOnBet * 1.5);
                return(true);
            }

            // guard block
            return(false);
        }
Beispiel #2
0
        private void AnnounceWinnerForTheRound(Player _player, Player _dealer)
        {
            Console.WriteLine();
            if (!_dealer.IsBusted && _player.IsBusted)
            {
                Console.WriteLine($"{_dealer.Name} won.");
                _dealer.AddWinCount();
                _player.ChipsOnHand -= _player.ChipsOnBet;
            }
            else if (_dealer.IsBusted && !_player.IsBusted)
            {
                Console.WriteLine($"{_player.Name} won.");
                _player.AddWinCount();
                _player.ChipsOnHand += _player.ChipsOnBet;
            }
            else if (_dealer.IsBusted && _player.IsBusted)
            {
                Console.WriteLine("Tie game.");
            }
            else if (!_dealer.IsBusted && !_player.IsBusted)
            {
                if (_player.GetHandValue() > _dealer.GetHandValue())
                {
                    Console.WriteLine($"{_player.Name} won.");
                    _player.AddWinCount();
                    _player.ChipsOnHand += _player.ChipsOnBet;
                }
                else if (_player.GetHandValue() < _dealer.GetHandValue())
                {
                    Console.WriteLine($"{_dealer.Name} won.");
                    _dealer.AddWinCount();
                    _player.ChipsOnHand -= _player.ChipsOnBet;
                }

                else if (_player.GetHandValue() == _dealer.GetHandValue())
                {
                    Console.WriteLine("Tie game.");
                }
            }
        }