Exemple #1
0
        private void StartGameCycle()
        {
            ActionUI.DisplayStartGame(_game);

            _game.InitializePack();
            StartRound();

            while (_game.Cards.Count > 0)
            {
                var userChoose = _actionUI.ChooseHitOrStay();

                if (userChoose == (int)UserChooses.Hit)
                {
                    MakeHit();
                    ActionUI.ShowSetOfCards(_game);
                }

                if (_game.HasOver(_game.GetSumInHand(_game.Player)))
                {
                    Message.HandleActionIfLose();
                    ActionUI.ShowSetOfCards(_game);
                    break;
                }

                if (userChoose == (int)UserChooses.Stay)
                {
                    MakeStay();
                    ActionUI.ShowSetOfCards(_game);
                    return;
                }
            }
        }
Exemple #2
0
        private void StartRound()
        {
            _game.Dealer.Set.Add(_game.GetRandomCard());
            _game.Player.Set.Add(_game.GetRandomCard());
            _game.Player.Set.Add(_game.GetRandomCard());

            ActionUI.ShowSetOfCards(_game);

            if (_game.Player.Set.Count != 2)
            {
                return;
            }

            if (!_actionUI.MakeSarrendo())
            {
                return;
            }

            _game.MakeSarrendo(out int sarrendoBet);

            if (sarrendoBet > 0)
            {
                _game.Player.CountOfChips += sarrendoBet;
                _game.Bet = sarrendoBet;
            }
        }
Exemple #3
0
        public GameCycle()
        {
            _game     = new Game();
            _actionUI = new ActionUI();

            HasDouble    = false;
            HasInsurance = false;
        }