예제 #1
0
 public void MakeUnknown()
 {
     if (_listUnknownCards.Count == 0)
     {
         return;
     }
     _listUnknownCards.ForEach(thisCard => thisCard.IsUnknown = true);
 }
        protected override void AfterShuffle()
        {
            //this is what runs after the cards shuffle.
            _cardList = DeckList.ToRegularDeckDict();
            _cardList.ForEach(thisCard => thisCard.IsUnknown = false);
            var firstCol = GetFirstList();

            SaveRoot.Score = 13;
            _model !.Main1.ClearBoard(firstCol);
            _model.Waste1 !.ClearBoard(_cardList); //hopefully no problem this time (?)
        }
예제 #3
0
        protected override void AfterShuffleCards()
        {
            DeckRegularDict <SolitaireCard> output = new DeckRegularDict <SolitaireCard>
            {
                FindCardBySuitValue(EnumCardValueList.Queen, EnumSuitList.Spades),
                FindCardBySuitValue(EnumCardValueList.Queen, EnumSuitList.Diamonds),
                FindCardBySuitValue(EnumCardValueList.Queen, EnumSuitList.Clubs),
                FindCardBySuitValue(EnumCardValueList.Queen, EnumSuitList.Hearts)
            };

            CardList !.RemoveGivenList(output);
            output.Reverse();
            output.ForEach(thisCard => CardList.InsertBeginning(thisCard));
            _thisMod !.MainPiles1 !.ClearBoard();
            AfterShuffle();
        }
예제 #4
0
        public void NewGame(DeckRegularDict <RegularRummyCard> thisCol)
        {
            if (thisCol.Count != 8)
            {
                throw new BasicBlankException("There must be 8 cards for the card pool");
            }
            DeckRegularDict <RegularRummyCard> newCol = new DeckRegularDict <RegularRummyCard>();

            thisCol.ForEach(oldCard =>
            {
                RegularRummyCard newCard = new RegularRummyCard();
                newCard.Populate(oldCard.Deck); //this is the way to clone it.
                newCol.Add(newCard);
            });
            ObjectList.ReplaceRange(newCol);
        }
        public int Find15Combos(IDeckDict <CribbageCard> thisCol)
        {
            DeckRegularDict <CribbageCard> newCol = new DeckRegularDict <CribbageCard>();

            newCol.AddRange(thisCol);
            newCol.Add(StartCard());
            int          firstNumber;
            int          secondNumber;
            int          output = 0;
            CribbageCard secondCard;
            int          x = 0;

            newCol.ForEach(firstCard =>
            {
                if (firstCard.Value >= EnumCardValueList.Ten)
                {
                    firstNumber = 10;
                }
                else
                {
                    firstNumber = (int)firstCard.Value;
                }
                var loopTo = newCol.Count - 1; // because 0 based
                for (int y = x + 1; y <= loopTo; y++)
                {
                    secondCard = newCol[y];
                    if (secondCard.Value >= EnumCardValueList.Ten)
                    {
                        secondNumber = 10;
                    }
                    else
                    {
                        secondNumber = (int)secondCard.Value;
                    }
                    if (firstNumber + secondNumber == 15)
                    {
                        output++;
                    }
                }
                x += 1;
            });
            return(output);
        }