コード例 #1
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));
            }
        }
コード例 #2
0
            public int Compare(PokerPile p1, PokerPile p2)
            {
                int v = p2.Count - p1.Count;

                if (v == 0)
                {
                    return(_value.ValueOf(p2.NumType) - _value.ValueOf(p1.NumType));
                }
                else
                {
                    return(v);
                }
            }
コード例 #3
0
        public PRVerifyResult VerifyRoot(PokerPile pile, int pokerCount, int heartHostCount)
        {
            if (pile.Count > Count)
            {
                return(new PRVerifyResult(true, 0, 0, null));
            }

            if (pile.Count == Count)
            {
                int v1 = _value.ValueOf(pile.NumType);
                int v2 = _value.ValueOf(NumType);
                return(new PRVerifyResult(v1 > v2, 0, 0, null));
            }

            int needHeartHost = Count - pile.Count;

            if (needHeartHost <= heartHostCount)
            {
                return(new PRVerifyResult(true, 0, needHeartHost, null));
            }

            return(new PRVerifyResult(false, 0, 0, null));
        }
コード例 #4
0
 public int Compare(PokerPile p1, PokerPile p2)
 {
     return(_value.ValueOf(p2.NumType) - _value.ValueOf(p1.NumType));
 }