Ejemplo n.º 1
0
 public bool IsDealerWinner(Player a_player)
 {
     if (a_player.CalcScore() > g_maxScore)
     {
         return(true);
     }
     else if (CalcScore() > g_maxScore)
     {
         return(false);
     }
     return(CalcScore() >= a_player.CalcScore());
 }
Ejemplo n.º 2
0
 public bool IsDealerWinner(Player a_player)
 {
     if (a_player.CalcScore() > g_maxScore)
     {
         return true;
     }
     else if (CalcScore() > g_maxScore)
     {
         return false;
     }
     return m_equalScoreWinRule.DealerWins(CalcScore(), a_player.CalcScore());
 }
Ejemplo n.º 3
0
 public bool IsDealerWinner(Player a_player)
 {
     if (a_player.CalcScore() > g_maxScore)
     {
         return true;
     }
     else if (CalcScore() > g_maxScore)
     {
         return false;
     }
     return CalcScore() >= a_player.CalcScore();
 }
Ejemplo n.º 4
0
        public bool IsDealerWinner(Player a_player)
        {
            if (a_player.CalcScore() > g_maxScore)
            {
                return(true);
            }
            else if (CalcScore() > g_maxScore)
            {
                return(false);
            }

            return(m_winnerRule.GetWinner(CalcScore(), a_player.CalcScore()));//CalcScore() >= a_player.CalcScore();
        }
Ejemplo n.º 5
0
 public bool Hit(Player a_player)
 {
     if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver())
     {
         DealPlayerCard(true, a_player);
         // Checks if player score is equal to or bigger than 21 and if it is, then the player automaticly
         //Stands
         if (a_player.CalcScore() >= 21)
         {
             Stand();
         }
         return true;
     }
     return false;
 }
Ejemplo n.º 6
0
        public bool Hit(Player a_player)
        {
            if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver())
            {
                DealPlayerCard(true, a_player);

                if (a_player.CalcScore() >= 21)
                {
                    Stand();
                }

                return true;
            }
            return false;
        }
Ejemplo n.º 7
0
        public bool Hit(Player a_player)
        {
            //  m_observers.Add(nåtjävlaskit);

            if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver())
            {
                DealCardHandler(true, a_player);

                if (a_player.CalcScore() >= 21)
                {
                    Stand();
                }
                return true;
            }
            return false;
        }
Ejemplo n.º 8
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;
 }
Ejemplo n.º 9
0
 public bool IsGameOver(Player a_player)
 {
     if (a_player.CalcScore() > g_maxScore || m_deck != null && /*CalcScore() >= g_hitLimit*/ m_hitRule.DoHit(this) != true)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 10
0
 public bool IsDealerWinner(Player a_player)
 {
     if (m_winRule.DealerWins(a_player.CalcScore(), CalcScore(), m_maxScoreRule.MaxScore()))
     {
         return true;
     }
     return false;
 }
Ejemplo n.º 11
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;
 }
Ejemplo n.º 12
0
 public bool Hit(Player a_player)
 {
     if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver())
     {
         GetShowAndDealCardToPlayer(true, a_player);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 13
0
 public bool Hit(Player a_player)
 {
     if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver(a_player))
     {
         a_player.DealShownCardFromDeck(m_deck);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 14
0
 public bool Hit(Player a_player)
 {
     if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver())
     {
         AddCard(a_player, true);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 15
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;
 }
Ejemplo n.º 16
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;
 }
Ejemplo n.º 17
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;
 }
Ejemplo n.º 19
0
 public bool Hit(Player a_player)
 {
     if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver())
     {
         m_softRule.DoHit(this);
         DealerDealsCard(m_deck, a_player, true);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 20
0
 public bool IsDealerWinner(Player a_player)
 {
     if (a_player.CalcScore() > g_maxScore)
     {
         return(true);
     }
     else if (CalcScore() > g_maxScore)
     {
         return(false);
     }
     else if (CalcScore() > a_player.CalcScore() && CalcScore() <= g_maxScore)
     {
         return(true);
     }
     else
     {
         return(m_winRule.isWinner(CalcScore(), a_player.CalcScore()));
     }
 }
Ejemplo n.º 21
0
 public bool Hit(Player a_player)
 {
     if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver())
     {
         m_dealCardRule.DealCard(m_deck, this, a_player);
         NotifySubscriber();
         return(true);
     }
     return(false);
 }
Ejemplo n.º 22
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;
        }
Ejemplo n.º 23
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;
        }
Ejemplo n.º 24
0
        public bool Hit(Player a_player)
        {
            if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver())
            {
                GetCardFromDeckAndDealIt(a_player, true);

                return(true);
            }
            return(false);
        }
Ejemplo n.º 25
0
 public bool Hit(Player a_player)
 {
     if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver())
     {
         GetShowDealCard(true, a_player);
         this.CallObservers();
         return(true);
     }
     return(false);
 }
Ejemplo n.º 26
0
 public bool IsDealerWinner(Player a_player)
 {
     if (a_player.CalcScore() > g_maxScore)
     {
         return true;
     }
     else if (CalcScore() > g_maxScore)
     {
         return false;
     }
     else if (a_player.CalcScore() == CalcScore())
     {
         //    //This is our own rule:
         //    //When the player and dealer ends up equal we made it so that the highest card
         //    //on their hand decides the winner. If both have the same card value, let's say both got Ace as
         //    //highest then the card color decides the winner in order: spade > heart > diamon > club
         return m_tieRule.CalcWinner(a_player, this);
     }
     return  CalcScore() >= a_player.CalcScore();
 }
Ejemplo n.º 27
0
        public bool Hit(Player a_player)
        {
            if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver())
            {

                a_player.GetNewCard(true, m_deck);

                return true;
            }
            return false;
        }
Ejemplo n.º 28
0
        public bool Hit(Player a_player)
        {
            if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver(a_player))
            {
                Card c = m_deck.GetCard();
                a_player.insertCard(c);

                return(true);
            }
            return(false);
        }
        public bool IsDealerWinner(Player a_player, Dealer a_dealer)
        {
            //Vem vinner vid lika???            
            if (m_EqualRule.IfEqual(a_player, a_dealer))
            {
                //return true = Dealer is winner at equal over 17
                //return false = player is winner at equal over 17
                return true; 
            }

            if (a_player.CalcScore() > g_maxScore)
            {
                return true;
            }
            else if (CalcScore() > g_maxScore)
            {
                return false;
            }
            return CalcScore() >= a_player.CalcScore();
        }
Ejemplo n.º 30
0
 public bool IsDealerWinner(Player a_player)
 {
     if (a_player.CalcScore() > g_maxScore)
     {
         return(true);
     }
     else if (CalcScore() > g_maxScore)
     {
         return(false);
     }
     else if (CalcScore() > a_player.CalcScore())
     {
         return(true);
     }
     else if (CalcScore() == a_player.CalcScore())
     {
         return(m_winRule.IsWinner(this.CalcScore(), a_player.CalcScore()));
     }
     return(false);
 }
Ejemplo n.º 31
0
        public bool IsDealerWinner(Player a_player)
        {
            bool dealerWon = m_winRule.Verdict();

            if (a_player.CalcScore() > g_maxScore)
            {
                return(true);
            }

            else if (CalcScore() > g_maxScore)
            {
                return(false);
            }

            else if (a_player.CalcScore() == CalcScore())
            {
                return(dealerWon);
            }

            return(CalcScore() >= a_player.CalcScore());
        }
Ejemplo n.º 32
0
 public bool IsDealerWinner(Player a_player)
 {
     if (a_player.CalcScore() > g_maxScore)
     {
         return(true);
     }
     else if (CalcScore() > g_maxScore)
     {
         return(false);
     }
     return(m_winRule.whoWins(this, a_player));
 }
Ejemplo n.º 33
0
 public bool Hit(Player a_player)
 {
     if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver())
     {
         Card c = m_deck.GetCard();
         c.Show(true);
         a_player.DealCard(c);
         NewCard();
         return true;
     }
     return false;
 }
Ejemplo n.º 34
0
 public bool IsGameOver(Player a_player)
 {
     if (m_deck != null && m_hitRule.DoHit(this) != true)
     {
         return(true);
     }
     else if (a_player.CalcScore() > g_maxScore)
     {
         ShowHand();
         return(true);
     }
     return(false);
 }
Ejemplo n.º 35
0
 public bool IsGameOver(Player a_player)
 {
     if (m_deck != null && m_hitRule.DoHit(this) != true)
     {
         return true;
     }
     else if (a_player.CalcScore() > g_maxScore)
     {
         ShowHand();
         return true;
     }
     return false;
 }
Ejemplo n.º 36
0
        public bool Hit(Player a_player)
        {
            if (m_deck != null && a_player.CalcScore() < m_winRule.MaxScore && !IsGameOver())
            {
                //Card c;
                //c = m_deck.GetCard();
                //c.Show(true);
                a_player.DealCard(GetCardAndShow());

                return true;
            }
            return false;
        }
Ejemplo n.º 37
0
        public bool IsDealerWinner(Player a_player)
        {
            if (a_player.CalcScore() > g_maxScore)
            {
                return true;
            }
            else if (CalcScore() > g_maxScore)
            {
                return false;
            }

            return m_winnerRule.IsDealerWinner(a_player, CalcScore());
        }
Ejemplo n.º 38
0
        public bool Hit(Player a_player)
        {
            if (m_deck != null && a_player.CalcScore() < m_basicRule.MaxScore() && !IsGameOver())
            {
                Card c;
                c = m_deck.GetCard();
                c.Show(true);
                a_player.DealCard(c);

                return(true);
            }
            return(false);
        }
Ejemplo n.º 39
0
        public bool Hit(Player a_player)
        {
            if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver())
            {
                // Card c;
                // c = m_deck.GetCard();
                // c.Show(true);
                // a_player.DealCard(c);
                HandCard(a_player, true);

                return(true);
            }
            return(false);
        }
Ejemplo n.º 40
0
 public bool Hit(Player a_player)
 {
     if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver(a_player))
     {
         /*Card c;
          * c = m_deck.GetCard();
          * c.Show(true);
          * a_player.DealCard(c);*/
         DealCard(true, a_player);
         //Here we should have some sort of Observer notification
         return(true);
     }
     return(false);
 }
Ejemplo n.º 41
0
        public bool IsDealerWinner(Player a_player)
        {
            if (a_player.CalcScore() > g_maxScore)
            {
                return(true);
            }
            else if (CalcScore() > g_maxScore)
            {
                return(false);
            }

            // Added code.
            else if (CalcScore() > a_player.CalcScore())
            {
                return(true);
            }

            else if (CalcScore() < a_player.CalcScore())
            {
                return(false);
            }

            return(m_ResultRule.IsDealerWinnerEqualScore());
        }
Ejemplo n.º 42
0
        public bool Hit(Player a_player)
        {
            if (m_deck != null && a_player.CalcScore() < g_maxScore && !IsGameOver())
            {
                //Card c;
                //c = m_deck.GetCard();
                //c.Show(true);
                //a_player.DealCard(c);
                DealCard(this, true);

                //rules.NewStrategy.DealNewCards(a_player, m_deck, true);

                return true;
            }
            return false;
        }
Ejemplo n.º 43
0
        /*******/
        public bool IsDealerWinner(Player a_player)
        {
            //if (a_player.CalcScore() > g_maxScore)
            //{
            //    return true;
            //}
            //else if (CalcScore() > g_maxScore)
            //{
            //    return false;
            //}
            //return CalcScore() >= a_player.CalcScore();

            //Strategy pattern is used
            int a_dealerScore = CalcScore();
            int a_playerScore = a_player.CalcScore();
            return m_winnerRule.IsDealerWinner(a_playerScore, a_dealerScore, g_maxScore);
        }
Ejemplo n.º 44
0
        public bool Hit(Player a_player)
        {
            int score = a_player.CalcScore();

            if (m_deck != null && (score <= g_maxScore) && !IsGameOver(a_player))
            {
                NewCard(m_deck, a_player);
                /*
                Card c;
                c = m_deck.GetCard();
                c.Show(true);
                a_player.DealCard(c);
                */
                return true;
            }
            return false;
        }
Ejemplo n.º 45
0
        /*******/

        public bool IsDealerWinner(Player a_player)
        {
            //if (a_player.CalcScore() > g_maxScore)
            //{
            //    return true;
            //}
            //else if (CalcScore() > g_maxScore)
            //{
            //    return false;
            //}
            //return CalcScore() >= a_player.CalcScore();

            //Strategy pattern is used
            int a_dealerScore = CalcScore();
            int a_playerScore = a_player.CalcScore();

            return(m_winnerRule.IsDealerWinner(a_playerScore, a_dealerScore, g_maxScore));
        }
Ejemplo n.º 46
0
        public bool Hit(Player a_player)
        {
            int score = a_player.CalcScore();

            if (m_deck != null && (score <= g_maxScore) && !IsGameOver(a_player))
            {
                NewCard(m_deck, a_player);

                /*
                 * Card c;
                 * c = m_deck.GetCard();
                 * c.Show(true);
                 * a_player.DealCard(c);
                 */
                return(true);
            }
            return(false);
        }
Ejemplo n.º 47
0
        public bool Stand(Player a_player)
        {
            int score = a_player.CalcScore();

            if (m_deck != null && (score <= g_maxScore) && !IsGameOver(a_player))
            {
                ShowHand();
                while (m_hitRule.DoHit(this))
                {
                    NewCard(m_deck, this);

                    /*
                     * Card c = m_deck.GetCard();
                     * c.Show(true);
                     * DealCard(c);
                     */
                }
                ;
                return(true);
            }

            return(false);
        }
Ejemplo n.º 48
0
 public bool IsDealerWinner(Player a_player)
 {
     return(m_winnerRule.WinnerStrategy(a_player.CalcScore(), CalcScore(), g_maxScore));
 }
Ejemplo n.º 49
0
 public bool IsDealerWinner(Player a_player)
 {
     return(m_winRule.IsDealerWinner(a_player.CalcScore(), CalcScore()));
 }
Ejemplo n.º 50
0
 public bool IsDealerWinner(Player a_player)
 {
     return(m_winRule.WhoWin(a_player.CalcScore(), CalcScore(), g_maxScore));
 }
Ejemplo n.º 51
0
        public bool IsDealerWinner(Player a_player)
        {
            if (a_player.CalcScore() > g_maxScore)
            {
                return true;
            }
            else if (CalcScore() > g_maxScore)
            {
                return false;
            }
            else if(m_drawRule.doWin(a_player, this))
            {
                return false;
            }

            return CalcScore() >= a_player.CalcScore();
        }
Ejemplo n.º 52
0
        public bool Stand(Player a_player)
        {
            int score = a_player.CalcScore();
            if (m_deck != null && ( score <= g_maxScore) && !IsGameOver(a_player))
            {
                ShowHand();
                while (m_hitRule.DoHit(this)){
                    NewCard(m_deck, this);
                    /*
                    Card c = m_deck.GetCard();
                    c.Show(true);
                    DealCard(c);
                     */
                };
                return true;
            }

            return false;
        }
 public bool IsDealerWinner(Player a_player)
 {
     return m_winRule.IsDealerWinner(CalcScore(), a_player.CalcScore(), g_maxScore);
 }
Ejemplo n.º 54
0
 public bool IsDealerWinner(Player a_player)
 {
     return m_winRule.isDealerWinner(a_player.CalcScore(), CalcScore());
 }
Ejemplo n.º 55
0
 public void CardDealt(Card card, Player player)
 {
     Thread.Sleep(550);
     if (UserSession.Connection != null)
     {
         GlobalHost.ConnectionManager.GetHubContext<CardDealtHub>().Clients.Client(UserSession.Connection).sendMessage(card.GetColor(), card.GetValue(), player.ToString(), player.CalcScore());
     }
 }
Ejemplo n.º 56
0
 public int GetPlayerScore()
 {
     return(m_player.CalcScore());
 }