Exemplo n.º 1
0
 public void Deal(Player a_player, bool show = true)
 {
     Card c;
     c = m_deck.GetCard();
     c.Show(show);
     a_player.DealCard(c);
 }
Exemplo n.º 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();
 }
Exemplo n.º 3
0
 public void DealCard(Player a_player, bool a_show)
 {
     Card c;
     c = m_deck.GetCard();
     c.Show(a_show);
     a_player.DealCard(c);
 }
Exemplo n.º 4
0
 public void NewCard(Player a_player, bool show)
 {
     Card c = m_deck.GetCard();
     c.Show(show);
     a_player.DealCard(c);
     UpdateObservers();
 }
Exemplo n.º 5
0
 public void DealCard(bool show, Player a_player)
 {
     Card c;
     c = m_deck.GetCard();
     c.Show(show);
     a_player.DealCard(c);
 }
Exemplo n.º 6
0
 public void StartNewRound(Player a_player)
 {
     if (m_deck == null)
     {
         m_deck = new Deck();
         m_startGameRule.StartNewRound(a_player, this, m_deck);
     }
 }
Exemplo n.º 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();
 }
Exemplo n.º 8
0
 public bool IsDealerWinner(Player a_player)
 {
     if (m_winRule.DealerWins(a_player.CalcScore(), CalcScore(), m_maxScoreRule.MaxScore()))
     {
         return true;
     }
     return false;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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)) ;
        }
Exemplo n.º 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;
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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();
     }
 }
Exemplo n.º 19
0
        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;
        }
Exemplo n.º 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();
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
 }
Exemplo n.º 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;
        }
Exemplo n.º 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);
 }
Exemplo n.º 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();
     }
 }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 28
0
 public bool IsDealerWinner(Player a_player)
 {
     if (m_wonRule.IsDealerWinning(this, a_player))
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 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())
            {
                ;
            }
        }