public override bool CanMoveCards(int whichOne, out int lastOne)
        {
            if (PreviousSelected == -1)
            {
                throw new BasicBlankException("Cannot find out whether we can move the cards because none was selected");
            }
            lastOne = -1; //until i figure out what else to do.
            var givList = Piles.ListGivenCards(PreviousSelected);

            TempList = givList.ListValidCardsAlternateColors();
            var           thisPile = Piles.PileList[whichOne];
            SolitaireCard oldCard;

            if (thisPile.CardList.Count == 0)
            {
                lastOne = TempList.Count - 1;
                return(true);
            }
            oldCard = Piles.GetLastCard(whichOne);
            if (oldCard.Value == EnumCardValueList.LowAce)
            {
                return(false);
            }
            return(TempList.CanMoveCardsAlternateColors(oldCard, ref lastOne));
        }
Esempio n. 2
0
        private DeckRegularDict <SolitaireCard> ListValidCards()
        {
            var output = Piles.ListGivenCards(PreviousSelected);

            if (output.Count == 0)
            {
                return(new DeckRegularDict <SolitaireCard>()); //decided this instead of error.
            }
            return(output.ListValidCardsSameSuit());
        }
        public bool CanMoveCards(int whichOne, out int lastOne, int room)
        {
            if (PreviousSelected == -1)
            {
                throw new BasicBlankException("Cannot find out whether we can move the cards because none was selected");
            }
            lastOne = -1; //until i figure out what else to do.
            var givList = Piles.ListGivenCards(PreviousSelected);

            TempList = givList.ListValidCardsAlternateColors();
            var           thisPile = Piles.PileList[whichOne];
            SolitaireCard oldCard;

            if (thisPile.CardList.Count == 0)
            {
                if (room > TempList.Count)
                {
                    lastOne = TempList.Count - 1;
                }
                else
                {
                    lastOne = room - 1;
                }
                return(true);
            }
            oldCard = Piles.GetLastCard(whichOne);
            if (oldCard.Value == EnumCardValueList.LowAce)
            {
                return(false);
            }

            //can't quite do the extension because of the room part.

            for (int x = TempList.Count; x >= 1; x += -1)
            {
                var newCard = TempList[x - 1];
                if (newCard.Value + 1 == oldCard.Value && newCard.Color != oldCard.Color && x <= room)
                {
                    lastOne = x - 1;
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 4
0
        public override bool CanMoveCards(int whichOne, out int lastOne)
        {
            lastOne = -1; //until i figure out what else to do.
            if (PreviousSelected == -1)
            {
                throw new BasicBlankException("Cannot find out whether we can move the cards because none was selected");
            }
            var firstList = Piles.ListGivenCards(PreviousSelected);

            TempList = firstList.ListValidCardsSameSuit(); //has to use templist
            var thisPile = Piles.PileList[whichOne];

            if (thisPile.CardList.Count == 0)
            {
                lastOne = TempList.Count - 1;
                return(true);
            }
            var oldCard = Piles.GetLastCard(whichOne);

            return(TempList.CanMoveCardsSameColor(oldCard, ref lastOne));
        }
        public override bool CanMoveCards(int whichOne, out int lastOne)
        {
            if (PreviousSelected == -1)
            {
                throw new BasicBlankException("Cannot find out whether we can move the cards because none was selected");
            }
            var firstList = Piles.ListGivenCards(PreviousSelected);

            TempList = firstList.ListValidCardsAlternateColors(); //has to use templist
            var thisPile = Piles.PileList[whichOne];

            lastOne = TempList.Count - 1;
            if (thisPile.CardList.Count == 0)
            {
                return(true);
            }
            var prevCard = Piles.GetLastCard(whichOne);
            var thisCard = Piles.PileList[PreviousSelected].CardList.First();

            return(prevCard.Value - 1 == thisCard.Value && prevCard.Suit != thisCard.Suit);
        }