Ejemplo n.º 1
0
        public Card[] CreateCombo(Card firstCard, Card secondCard)
        {
            _combo[0].CardFace = firstCard.CardFace;
            _combo[0].CardSuit = firstCard.CardSuit;
            _combo[1].CardFace = secondCard.CardFace;
            _combo[1].CardSuit = secondCard.CardSuit;

            return _combo;
        }
Ejemplo n.º 2
0
 // Находим в колоде карты всех мастей с данным номиналом 
 // и копируем их в отдельный массив
 private void PushHandInstances(char card, Card[] array)
 {
     for (int i = 0, j = 0; j < array.Length; i++)
     {
         if (_deck[i].CardFace == card)
         {
             array[j] = _deck[i];
             j++;
         }
     }
 }
Ejemplo n.º 3
0
        public bool CompareCombos(Card[] hand)
        {
            if ((_combo[0].CardFace == hand[0].CardFace && _combo[0].CardSuit == hand[0].CardSuit
                && _combo[1].CardFace == hand[1].CardFace && _combo[1].CardSuit == hand[1].CardSuit)
                || (_combo[0].CardFace == hand[1].CardFace && _combo[0].CardSuit == hand[1].CardSuit
                && _combo[1].CardFace == hand[0].CardFace && _combo[1].CardSuit == hand[0].CardSuit))
            {
                return true;
            }

            return false;
        }
Ejemplo n.º 4
0
        // Конвертирует короткую запись карманных пар в полный
        // перечень комбинаций данной карманной пары
        private void ConvertPocketPairs(Card[] combos)
        {
            Combo temp = new Combo();

            for (int i = 0; i < combos.Length - 1; i++)
            {
                for (int j = i + 1; j < combos.Length; j++, _combosCounter++)
                {
                    temp = new Combo();
                    temp.CreateCombo(combos[i], combos[j]);
                    _convertedRange[_combosCounter] = temp;

                }
            }
        }
Ejemplo n.º 5
0
        public void Deal()
        {
            var myHoleCards = new Card[2];
            var flop = new Card[3];
            var turn = new Card[1];
            var river = new Card[1];

            for (var i = 0; i < myHoleCards.Length; i++)
            {
                myHoleCards[i] = _deck[_indexArray[i]];
            }

            for (var i = 2; i < flop.Length + 2; i++)
            {
                flop[i - 2] = _deck[_indexArray[i]];
            }

            turn[0] = _deck[_indexArray[5]];
            river[0] = _deck[_indexArray[6]];
        }
Ejemplo n.º 6
0
 public void ShowHeroCards(Card[] deck, System.Windows.Forms.Label firstCard, System.Windows.Forms.Label secondCard)
 {
     PutCardInLabel(deck[0], firstCard);
     PutCardInLabel(deck[1], secondCard);
 }
Ejemplo n.º 7
0
        private void PutCardInLabel(Card card, System.Windows.Forms.Label label)
        {
            label.Text = Convert.ToString(card.CardFace);

            switch (card.CardSuit)
            {
                case 'c': label.BackColor = Color.FromArgb(38,173,95);
                    break;
                case 'd': label.BackColor = Color.FromArgb(65,165,224);
                    break;
                case 'h': label.BackColor = Color.FromArgb(217,83,79);
                    break;
                case 's': label.BackColor = Color.FromArgb(125,123,120);
                    break;
                default:
                    break;
            }
        }
Ejemplo n.º 8
0
        public Card[] DealHeroCards()
        {
            var heroCards = new Card[2];
            var container = "";

            for (var i = 0; i < heroCards.Length; i++)
            {
                heroCards[i] = _deck[_indexArray[i]];
                container += heroCards[i].CardFace.ToString();
                container += heroCards[i].CardSuit.ToString();
            }

            //Show(heroCards);

            return heroCards;
        }
Ejemplo n.º 9
0
        public void Deal(string filePath)
        {
            var container = "";
            var myHoleCards = new Card[2];
            var flop = new Card[3];
            var turn = new Card[1];
            var river = new Card[1];

            for (var i = 0; i < myHoleCards.Length; i++)
            {
                myHoleCards[i] = _deck[_indexArray[i]];
                container += Convert.ToString(myHoleCards[i].CardFace);
                container += Convert.ToString(myHoleCards[i].CardSuit);
            }

            container += "   ";

            for (var i = 2; i < flop.Length + 2; i++)
            {
                flop[i - 2] = _deck[_indexArray[i]];
                container += Convert.ToString(_deck[_indexArray[i]].CardFace);
                container += Convert.ToString(_deck[_indexArray[i]].CardSuit);
            }

            container += " ";

            turn[0] = _deck[_indexArray[5]];

            container += turn[0].CardFace;
            container += turn[0].CardSuit;
            container += " ";

            river[0] = _deck[_indexArray[6]];

            container += river[0].CardFace;
            container += river[0].CardSuit;

            container += "\r";

            File.AppendAllText(filePath, container);
        }
Ejemplo n.º 10
0
        // Конвертирует короткую запись не парного покета в полный
        // перечень комбинаций данной карманной пары
        private void ConvertUnpaired(Card[] firstCardArray, Card[] secondCardArray)
        {
            Combo temp = new Combo();

            for (int i = 0; i < firstCardArray.Length; i++)
            {
                for (int j = 0; j < secondCardArray.Length; j++, _combosCounter++)
                {
                    temp = new Combo();
                    temp.CreateCombo(firstCardArray[i], secondCardArray[j]);
                    _convertedRange[_combosCounter] = temp;
                }
            }
        }
Ejemplo n.º 11
0
        public bool CheckHeroAction(Card[] holeCards)
        {
            Combo temp = new Combo();

            bool comboFromRange = false;

            for (int i = 0; i < _combosCounter; i++)
            {
                temp = new Combo();
                temp = _convertedRange[i];
                comboFromRange = temp.CompareCombos(holeCards);

                if (comboFromRange == true)
                {
                    return comboFromRange;
                }
            }

            return comboFromRange;
        }
Ejemplo n.º 12
0
        private void ConvertUnsuitedHand(Card[] firstCardArray, Card[] secondCardArray)
        {
            Combo temp = new Combo();

            for (int i = 0; i < firstCardArray.Length; i++)
            {
                for (int j = 0; j < secondCardArray.Length; j++)
                {
                    if (secondCardArray[j].CardSuit != firstCardArray[i].CardSuit)
                    {
                        temp = new Combo();
                        temp.CreateCombo(firstCardArray[i], secondCardArray[j]);
                        _convertedRange[_combosCounter] = temp;
                        _combosCounter++;
                    }
                }
            }
        }