示例#1
0
        public int FindHolding(IGetCard map, HoldingStack holdingStack, bool inclusive, Pile fromPile, int from, int fromStart, int fromEnd, int to, int maxExtraSuits)
        {
            holdingStack.StartingRow = fromEnd;
            int firstRow   = fromStart + (inclusive ? 0 : 1);
            int lastRow    = fromEnd - fromPile.GetRunUp(fromEnd);
            int extraSuits = 0;

            for (int fromRow = lastRow; fromRow >= firstRow; fromRow--)
            {
                if (fromRow < lastRow &&
                    fromPile[fromRow].Suit != fromPile[fromRow + 1].Suit)
                {
                    extraSuits++;
                }
                if (extraSuits > maxExtraSuits)
                {
                    return(holdingStack.Suits);
                }
                Card fromCard = fromPile[fromRow];
                for (int column = 0; column < NumberOfPiles; column++)
                {
                    if (column == from || column == to)
                    {
                        continue;
                    }
                    if (fromCard.IsSourceFor(map.GetCard(column)))
                    {
                        int holdingSuits = extraSuits;
                        if (fromRow == fromStart || fromCard.Suit != fromPile[fromRow - 1].Suit)
                        {
                            holdingSuits++;
                        }
                        if (holdingSuits > holdingStack.Suits)
                        {
                            int length = holdingStack.FromRow - fromRow;
                            holdingStack.Push(new HoldingInfo(from, fromRow, column, holdingSuits, length));
                        }
                    }
                }
            }
            return(holdingStack.Suits);
        }
示例#2
0
 public int FindHolding(IGetCard map, HoldingStack holdingStack, bool inclusive, Pile fromPile, int from, int fromStart, int fromEnd, int to, int maxExtraSuits)
 {
     return game.FindHolding(map, holdingStack, inclusive, fromPile, from, fromStart, fromEnd, to, maxExtraSuits);
 }
示例#3
0
 public int FindHolding(IGetCard map, HoldingStack holdingStack, bool inclusive, Pile fromPile, int from, int fromStart, int fromEnd, int to, int maxExtraSuits)
 {
     holdingStack.StartingRow = fromEnd;
     int firstRow = fromStart + (inclusive ? 0 : 1);
     int lastRow = fromEnd - fromPile.GetRunUp(fromEnd);
     int extraSuits = 0;
     for (int fromRow = lastRow; fromRow >= firstRow; fromRow--)
     {
         if (fromRow < lastRow &&
             fromPile[fromRow].Suit != fromPile[fromRow + 1].Suit)
         {
             extraSuits++;
         }
         if (extraSuits > maxExtraSuits)
         {
             return holdingStack.Suits;
         }
         Card fromCard = fromPile[fromRow];
         for (int column = 0; column < NumberOfPiles; column++)
         {
             if (column == from || column == to)
             {
                 continue;
             }
             if (fromCard.IsSourceFor(map.GetCard(column)))
             {
                 int holdingSuits = extraSuits;
                 if (fromRow == fromStart || fromCard.Suit != fromPile[fromRow - 1].Suit)
                 {
                     holdingSuits++;
                 }
                 if (holdingSuits > holdingStack.Suits)
                 {
                     int length = holdingStack.FromRow - fromRow;
                     holdingStack.Push(new HoldingInfo(from, fromRow, column, holdingSuits, length));
                 }
             }
         }
     }
     return holdingStack.Suits;
 }
示例#4
0
 public int FindHolding(IGetCard map, HoldingStack holdingStack, bool inclusive, Pile fromPile, int from, int fromStart, int fromEnd, int to, int maxExtraSuits)
 {
     return(game.FindHolding(map, holdingStack, inclusive, fromPile, from, fromStart, fromEnd, to, maxExtraSuits));
 }