public PRVerifyResult(bool success, int stepCount, int usedHeartHostCount, PokerPile insertedHeadPile)
 {
     Success            = success;
     StepCount          = stepCount;
     UsedHeartHostCount = usedHeartHostCount;
     InsertedHeadPile   = insertedHeadPile;
 }
示例#2
0
        public PRVerifyResult Verify(PokerPile previous, PokerPile current, int pokerCount, int heartHostCount)
        {
            if (pokerCount < current.Count)
            {
                return(new PRVerifyResult(false, 0, 0, null));
            }

            int needHeartHost = pokerCount - current.Count;

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

            if (needHeartHost <= heartHostCount)
            {
                current.AddPoker(needHeartHost);
                return(new PRVerifyResult(true, 0, needHeartHost, null));
            }
            else
            {
                return(new PRVerifyResult(false, 0, 0, null));
            }
        }
示例#3
0
        public PRVerifyResult VerifyRoot(PokerPile pile, int pokerCount, int heartHostCount)
        {
            if (pile == null)
            {
                return(new PRVerifyResult(false, 0, 0, null));
            }

            if (pokerCount < pile.Count)
            {
                return(new PRVerifyResult(false, 0, 0, null));
            }

            int needHeartHost = pokerCount - pile.Count;

            if (needHeartHost > heartHostCount)
            {
                return(new PRVerifyResult(false, 0, 0, null));
            }

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

            pile.AddPoker(needHeartHost);
            return(new PRVerifyResult(true, 0, needHeartHost, null));
        }
示例#4
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));
            }
        }
        public PokerPileChain(PokerPile firstPile, int heartHostCount)
        {
            if (firstPile != null)
            {
                this.Head.Next = firstPile;
            }

            HeartHostCount = heartHostCount;
        }
示例#6
0
        public PRVerifyResult Verify(PokerPile previous, PokerPile current, int pokerCount, int heartHostCount)
        {
            if (previous == null || current == null)
            {
                return(new PRVerifyResult(false, 0, 0, null));
            }

            int v1 = previous.NumType == PokerNumType.PA ? 1 : previous.NumType;
            int v2 = current.NumType;

            int stepCount = v2 - v1 - 1;

            if (stepCount != 0)
            {
                return(new PRVerifyResult(false, 0, 0, null));
            }

            int needHeartHost = pokerCount - current.Count;

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

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

            if (needHeartHost <= heartHostCount)
            {
                current.AddPoker(needHeartHost);
                return(new PRVerifyResult(true, stepCount, needHeartHost, null));
            }
            else
            {
                return(new PRVerifyResult(false, 0, 0, null));
            }
        }
示例#7
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));
        }
示例#8
0
 public PRVerifyResult Verify(PokerPile previous, PokerPile current, int pokerCount, int heartHostCount)
 {
     return(new PRVerifyResult(false, 0, 0, null));
 }
示例#9
0
        public PRVerifyResult Verify(PokerPile previous, PokerPile current, int pokerCount, int heartHostCount)
        {
            if (previous == null || current == null)
            {
                return(new PRVerifyResult(false, 0, 0, null));
            }

            if (pokerCount < current.Count)
            {
                return(new PRVerifyResult(false, 0, 0, null));
            }

            if (current.NumType == PokerNumType.PA && current.Next != null)
            {
                return(new PRVerifyResult(false, 0, 0, null));
            }

            int v1        = previous.NumType;
            int v2        = current.NumType == PokerNumType.PA ? 1 : current.NumType;
            int v         = v1 - v2;
            int stepCount = v - 1;

            if (v < 1)
            {
                return(new PRVerifyResult(false, 0, 0, null));
            }

            int needHeartHost = stepCount * pokerCount + (pokerCount - current.Count);

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

            if (needHeartHost <= heartHostCount)
            {
                PokerPile cur          = previous;
                PokerPile insertedHead = null;
                for (int i = 1; i <= stepCount; i++)
                {
                    PokerPile newPile = new PokerPile(previous.NumType - i);
                    if (insertedHead == null)
                    {
                        insertedHead = newPile;
                    }

                    newPile.AddPoker(pokerCount);
                    cur.Next     = newPile;
                    newPile.Next = current;
                    cur          = newPile;
                }

                current.AddPoker(pokerCount - current.Count);
                return(new PRVerifyResult(true, stepCount, needHeartHost, insertedHead));
            }
            else
            {
                return(new PRVerifyResult(false, 0, 0, null));
            }
        }
示例#10
0
 public PokerPile(int numType, int count, PokerPile next)
 {
     NumType = numType;
     Count   = count;
     Next    = next;
 }
示例#11
0
 public PRVerifyResult VerifyRoot(PokerPile pile, int pokerCount, int heartHostCount)
 {
     return(new PRVerifyResult(false, 0, 0, null));
 }
示例#12
0
 public PatternNull(int type, PokerPile headPile, int pokerCount)
     : base(type, headPile, PokerNumType.NULL, null)
 {
     _count = pokerCount;
 }