Ejemplo n.º 1
0
        // Is this the correct place for this function?
        // This function may need to be customisable to accomodate non-standard hands
        // (e.g. round-the-corner straights, tigers, skeets etc.)
        private void _evaluate()
        {
            int i;

            _sortByRank();
            _calcRankCount();
            _calcSuitCount();

            // Is it a straight flush?
            if (isStraightFlush(ref _numSubRanks, ref _subRank))
            {
                _rank = eHandType.HAND_STRAIGHT_FLUSH;
                return;
            }

            // fours?
            if (isFours(ref _numSubRanks, ref _subRank))
            {
                _rank = eHandType.HAND_FOURS;
                return;
            }

            // full house?
            if (isFullHouse(ref _numSubRanks, ref _subRank))
            {
                _rank = eHandType.HAND_FULL_HOUSE;
                return;
            }

            // flush?
            if (isFlush(ref _numSubRanks, ref _subRank))
            {
                _rank = eHandType.HAND_FLUSH;
                return;
            }

            // straight?
            if (isStraight(ref _numSubRanks, ref _subRank))
            {
                _rank = eHandType.HAND_STRAIGHT;
                return;
            }

            // threes?
            if (isThrees(ref _numSubRanks, ref _subRank))
            {
                _rank = eHandType.HAND_THREES;
                return;
            }

            // two pair?
            if (isTwoPair(ref _numSubRanks, ref _subRank))
            {
                _rank = eHandType.HAND_TWO_PAIR;
                return;
            }

            // one pair?
            if (isPair(ref _numSubRanks, ref _subRank))
            {
                _rank = eHandType.HAND_PAIR;
                return;
            }

            _rank = eHandType.HAND_RUNT;
            _numSubRanks = 5;

            // This works because the hand is already sorted in descending order
            for (i = 0; i < 5; i++)
            {
                _subRank[i] = _cards[i].Rank;
            }
        }
Ejemplo n.º 2
0
        // Is this the correct place for this function?
        // This function may need to be customisable to accomodate non-standard hands
        // (e.g. round-the-corner straights, tigers, skeets etc.)
        private void _evaluate()
        {
            int i;

            _sortByRank();
            _calcRankCount();
            _calcSuitCount();

            // Is it a straight flush?
            if (isStraightFlush(ref _numSubRanks, ref _subRank))
            {
                _rank = eHandType.HAND_STRAIGHT_FLUSH;
                return;
            }

            // fours?
            if (isFours(ref _numSubRanks, ref _subRank))
            {
                _rank = eHandType.HAND_FOURS;
                return;
            }

            // full house?
            if (isFullHouse(ref _numSubRanks, ref _subRank))
            {
                _rank = eHandType.HAND_FULL_HOUSE;
                return;
            }

            // flush?
            if (isFlush(ref _numSubRanks, ref _subRank))
            {
                _rank = eHandType.HAND_FLUSH;
                return;
            }

            // straight?
            if (isStraight(ref _numSubRanks, ref _subRank))
            {
                _rank = eHandType.HAND_STRAIGHT;
                return;
            }

            // threes?
            if (isThrees(ref _numSubRanks, ref _subRank))
            {
                _rank = eHandType.HAND_THREES;
                return;
            }

            // two pair?
            if (isTwoPair(ref _numSubRanks, ref _subRank))
            {
                _rank = eHandType.HAND_TWO_PAIR;
                return;
            }

            // one pair?
            if (isPair(ref _numSubRanks, ref _subRank))
            {
                _rank = eHandType.HAND_PAIR;
                return;
            }

            _rank        = eHandType.HAND_RUNT;
            _numSubRanks = 5;

            // This works because the hand is already sorted in descending order
            for (i = 0; i < 5; i++)
            {
                _subRank[i] = _cards[i].Rank;
            }
        }