public int Compare(PokerPile p1, PokerPile p2)
            {
                int v1 = _value.ValueInStraight(p1.NumType);
                int v2 = _value.ValueInStraight(p2.NumType);

                if (p1.NumType == PokerNumType.PA &&
                    (p2.NumType == PokerNumType.P2 ||
                     p2.NumType == PokerNumType.P3 ||
                     p2.NumType == PokerNumType.P4 ||
                     p2.NumType == PokerNumType.P5))
                {
                    v1 = 1;
                }

                if (p2.NumType == PokerNumType.PA &&
                    (p1.NumType == PokerNumType.P2 ||
                     p1.NumType == PokerNumType.P3 ||
                     p1.NumType == PokerNumType.P4 ||
                     p1.NumType == PokerNumType.P5
                    ))
                {
                    v2 = 1;
                }

                return(v2 - v1);
            }
示例#2
0
        public PRVerifyResult VerifyRoot(PokerPile pile, int pokerCount, int heartHostCount)
        {
            if (pile == null)
            {
                return(new PRVerifyResult(false, 0, 0, null));
            }

            bool isGoodValue;

            if (IsStraight)
            {
                if (pile.NumType == PokerNumType.PHost)
                {
                    return(new PRVerifyResult(false, 0, 0, null));
                }

                int v1 = pile.NumType == PokerNumType.PA ? 1 : _value.ValueInStraight(pile.NumType);

                if (_value.ValueInStraight(PokerNumType.PA) - v1 < (StraightCount - 1))
                {
                    isGoodValue = false;
                }
                else
                {
                    int v2 = NumType == PokerNumType.PA ? 1 : _value.ValueInStraight(NumType);
                    isGoodValue = v1 > v2;
                }
            }
            else
            {
                isGoodValue = _value.ValueOf(pile.NumType) > _value.ValueOf(NumType);
            }

            if (pile.Count >= pokerCount)
            {
                return(new PRVerifyResult(isGoodValue, 0, 0, null));
            }

            int needHeartHost = pokerCount - pile.Count;

            if (needHeartHost > 0 &&
                (pile.NumType == PokerNumType.PX || pile.NumType == PokerNumType.PD))
            {
                return(new PRVerifyResult(false, 0, 0, null));
            }

            if (needHeartHost <= heartHostCount)
            {
                if (isGoodValue)
                {
                    pile.AddPoker(needHeartHost);
                }
                return(new PRVerifyResult(isGoodValue, 0, needHeartHost, null));
            }
            else
            {
                return(new PRVerifyResult(false, 0, 0, null));
            }
        }