Example #1
0
 public void Deal(Player a_player, bool show = true)
 {
     Card c;
     c = m_deck.GetCard();
     c.Show(show);
     a_player.DealCard(c);
 }
Example #2
0
 public void DealCard(Player a_toGetCard, bool a_showCard)
 {
     var c = m_deck.GetCard();
     c.Show(a_showCard);
     a_toGetCard.DealCard(c);
     Notify();
 }
 public void DealCard(Player a_player, bool a_show)
 {
     Card c;
     c = m_deck.GetCard();
     c.Show(a_show);
     a_player.DealCard(c);
 }
Example #4
0
 public void NewCard(Player a_player, bool show)
 {
     Card c = m_deck.GetCard();
     c.Show(show);
     a_player.DealCard(c);
     UpdateObservers();
 }
Example #5
0
 public void DealCard(bool show, Player a_player)
 {
     Card c;
     c = m_deck.GetCard();
     c.Show(show);
     a_player.DealCard(c);
 }
Example #6
0
 public void StartNewRound(Player a_player)
 {
     if (m_deck == null)
     {
         m_deck = new Deck();
         m_startGameRule.StartNewRound(a_player, this, m_deck);
     }
 }
Example #7
0
 public Game(AbstractRulesFactory ruleSet)
 {
     rules = new RulesFactory(ruleSet);
     m_dealer = new Dealer(rules);
     //m_dealer = new Dealer(new rules.RulesFactory(ruleSet));
     m_player = new Player();
     PrepareGetRules();
 }
Example #8
0
 public bool IsDealerWinner(Player a_player)
 {
     if (m_winRule.DealerWins(a_player.CalcScore(), CalcScore(), m_maxScoreRule.MaxScore()))
     {
         return true;
     }
     return false;
 }
Example #9
0
 public bool IsGameOver(Player a_player)
 {
     if (m_deck != null && /*CalcScore() >= g_hitLimit*/ ((m_hitRule.DoHit(this) != true) || a_player.CalcScore() >= 21))
     {
         return true;
     }
     return false;
 }
Example #10
0
 public bool NewGame(Player a_player)
 {
     if (m_deck == null || IsGameOver())
     {
         m_deck = new Deck();
         return m_newGameRule.NewGame(this, a_player);
     }
     return false;
 }
Example #11
0
 public bool Hit(Player a_player)
 {
     if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver(a_player))
     {
         GetAndGiveNewCard(a_player, true);
         return true;
     }
     return false;
 }
Example #12
0
        static void Main(string[] args)
        {
            model.Dealer d = new model.Dealer();
            model.Player p = new model.Player();
            view.Console v = new view.Console();
            controller.Player c = new controller.Player();

            while (c.PlayGame(v, d, p)) ;
        }
Example #13
0
 public bool Hit(Player a_player)
 {
     if (m_deck != null && a_player.CalcScore() < m_winnerRule.maxScore && !IsGameOver())
     {
         DealCard(true, a_player);
         return true;
     }
     return false;
 }
Example #14
0
 public void HitPlayer(Player a_player)
 {
     if (m_deck != null && a_player.GetScoreOfHand() < 21)
     {
         Card c = m_deck.GetCard();
         c.Show();
         a_player.DealCard(c);
     }
 }
Example #15
0
 public bool Hit(Player a_player)
 {
     if (m_deck != null && a_player.CalcScore() < m_maxScoreRule.MaxScore() && !IsGameOver())
     {
         Deal(a_player, true);
         return true;
     }
     return false;
 }
 public bool Hit(Player a_player)
 {
     if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver())
     {
         DealCardToPlayer(a_player);
         return true;
     }
     return false;
 }
Example #17
0
 public bool Hit(Player a_player)
 {
     if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver())
     {
         DrawCardAndShowCard(a_player, true);
         return true;
     }
     return false;
 }
Example #18
0
 public void getShowDealCard(Player a_player, Boolean show)
 {
     Card c = m_deck.GetCard();
     c.Show(show);
     a_player.DealCard(c);
     foreach (BlackJackObserver o in m_observers)
     {
         o.CardDealt();
     }
 }
        public bool Hit(Player a_player)
        {
            if (m_deck != null && a_player.CalcScore() < m_winRule.GetMaxScore && !IsGameOver())
            {
                a_player.DealCard(true, m_deck.GetCard());

                return true;
            }
            return false;
        }
Example #20
0
 public void DealPlayerCard(bool hiddenCard, Player player)
 {
     Card c = m_deck.GetCard();
     c.Show(hiddenCard);
     player.DealCard(c);
     foreach (IGameobserver o in m_observer)
     {
         o.Playerhasacard();
     }
 }
Example #21
0
 public void Deal(Player player, bool show)
 {
     Card c = m_deck.GetCard();
     c.Show(show);
     player.DealCard(c);
     foreach (CardDealtListener l in m_subscribers)
     {
         l.CardDealt(c);
     }
 }
Example #22
0
 public void GetNewCard(Player a_player, bool a_showCard = true)
 {
     foreach (IBlackJackObserver a_observer in m_observers)
     {
         a_observer.AddCardDelay();
     }
     Card c = m_deck.GetCard();
     c.Show(a_showCard);
     a_player.DealCard(c);
 }
Example #23
0
        public bool Hit(Player a_player)
        {
            if (m_deck != null && a_player.CalcScore() < m_winRule.MaxScore && !IsGameOver())
            {
                GetCardAndShow(a_player);

                return true;
            }
            return false;
        }
Example #24
0
 public void NewCard(Player a_player, bool a_showCard)
 {
     foreach (IGameObserver a_observer in m_observer)
     {
         a_observer.CardDelay();
     }
     Card c = m_deck.GetCard();
     c.Show(a_showCard);
     a_player.DealCard(c);
 }
Example #25
0
 public void GetCard(Player player, bool showCard = true)
 {
     Card c = m_deck.GetCard();
     c.Show(showCard);
     player.DealCard(c);
     foreach(BlackJackObserver observer in m_BlackJackObserver)
     {
         observer.CardDisplayed();
     }
 }
Example #26
0
        public void Deal(Player person, Boolean value)
        {
            Card c = m_deck.GetCard();
            c.Show(value);
            person.DealCard(c);

            foreach (var observer in m_observer)
            {
                observer.cardDrawn(c);
            }
        }
Example #27
0
        public void NewCard(Deck aDeck, Player aPlayer, bool showCard = true)
        {
            Card newCardFromDeck = aDeck.GetCard();
            newCardFromDeck.Show(showCard);
            aPlayer.DealCard(newCardFromDeck);

            foreach (IBlackJackObserver observer in m_observers)
            {
                observer.newCardDelt();
            }
        }
Example #28
0
 public bool IsDealerWinner(Player a_player)
 {
     if (m_wonRule.IsDealerWinning(this, a_player))
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Example #29
0
        public void DealCardHandler(bool hiddenCard, Player player)
        {
            Card c = m_deck.GetCard();
            c.Show(hiddenCard);
            player.DealCard(c);
            foreach (IDrawCardObserver o in m_observers)
            {

                o.DrawCard(c);
            }
        }
Example #30
0
        // Tar ett kort, sparar, visar upp det.
        public void DrawCardAndShowCard(Player a_player, bool result)
        {
            Card c = m_deck.GetCard();
            c.Show(result);
            a_player.DealCard(c);

            foreach (var l in m_card)
            {
                l.PauseBeforeShowingCard();
            }
        }
Example #31
0
        static void Main(string[] args)
        {
            model.Dealer        d    = new model.Dealer(new model.rules.RulesFactory(), "Croupier");
            model.Player        p    = new model.Player("Player");
            model.Game          g    = new model.Game(d, p);
            view.IView          v    = new view.SwedishView();//new view.SimpleView();
            controller.PlayGame ctrl = new controller.PlayGame(v, g);

            d.Register(ctrl);

            while (ctrl.Play())
            {
                ;
            }
        }