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));
        }
        public override bool CanAddSingleCard(int whichOne, SolitaireCard thisCard)
        {
            if (Piles.HasCardInColumn(whichOne) == false)
            {
                return(true);
            }
            var oldCard = Piles.GetLastCard(whichOne);

            return(oldCard.Value - 1 == thisCard.Value && oldCard.Color != thisCard.Color);
        }
        public override bool CanAddSingleCard(int whichOne, SolitaireCard thisCard)
        {
            if (Piles.HasCardInColumn(whichOne) == false)
            {
                return(thisCard.Value == EnumCardValueList.King);
            }
            var prevCard = Piles.GetLastCard(whichOne);

            return(prevCard.Value - 1 == thisCard.Value && prevCard.Color != thisCard.Color);
        }
Ejemplo n.º 4
0
        public override bool CanAddSingleCard(int whichOne, SolitaireCard thisCard)
        {
            if (Piles.HasCardInColumn(whichOne) == false)
            {
                return(true);
            }
            var prevCard = Piles.GetLastCard(PreviousSelected);

            return(prevCard.Value - 1 == thisCard.Value && prevCard.Color == thisCard.Color);
        }
        public override bool CanMoveToAnotherPile(int whichOne)
        {
            SolitaireCard newCard;
            SolitaireCard oldCard;

            if (Piles.HasCardInColumn(whichOne) == false)
            {
                return(false);// cannot move because the empty piles are never filled
            }
            oldCard = Piles.GetLastCard(whichOne);
            newCard = GetCard(); // i think
            return(oldCard.Value - 1 == newCard.Value);
        }
        public override bool CanAddSingleCard(int whichOne, SolitaireCard thisCard)
        {
            if (Piles.HasCardInColumn(whichOne) == false)
            {
                if (GlobalClass.MainModel !.Heel1.IsEndOfDeck() == false)
                {
                    throw new BasicBlankException("If its not at the end of the deck; a card needs to be placed");
                }
                return(true);
            }
            var prevCard = Piles.GetLastCard(whichOne);

            return(prevCard.Value - 1 == thisCard.Value && prevCard.Suit != thisCard.Suit);
        }
        private bool CanBuildFromKing(int pile, SolitaireCard thisCard)
        {
            if (pile > 1)
            {
                throw new BasicBlankException($"Kings must be 0, or 1; not {pile}");
            }
            var oldCard = Piles.GetLastCard(pile);

            if (oldCard.Suit != thisCard.Suit)
            {
                return(false);
            }
            return(oldCard.Value - 1 == thisCard.Value);
        }
        public override bool CanAddSingleCard(int whichOne, SolitaireCard thisCard)
        {
            if (Piles.HasCardInColumn(whichOne) == false)
            {
                return(thisCard.Value == EnumCardValueList.King);
            }
            var oldCard = Piles.GetLastCard(whichOne);

            if (thisCard.Suit != oldCard.Suit)
            {
                return(false);
            }
            return(oldCard.Value - 1 == thisCard.Value);
        }
Ejemplo n.º 9
0
 public void RemoveCards(int whichOne)
 {
     if (TempList.Count != 13)
     {
         throw new BasicBlankException("Must have 13 cards to remove the 13 cards");
     }
     TempList.ForEach(tempCard => Piles.RemoveSpecificCardFromColumn(whichOne, tempCard.Deck));
     if (Piles.HasCardInColumn(whichOne))
     {
         var thisCard = Piles.GetLastCard(whichOne);
         Piles.RemoveFromUnknown(thisCard);
     }
     UnselectAllColumns();
 }
Ejemplo n.º 10
0
        public override bool CanMoveToAnotherPile(int whichOne)
        {
            if (Piles.HasCardInColumn(whichOne) == false)
            {
                return(true);
            }
            var oldCard = Piles.GetLastCard(whichOne);
            var newCard = GetCard();

            if (oldCard.Value == EnumCardValueList.LowAce && newCard.Value == EnumCardValueList.King)
            {
                return(true); // because round corner.
            }
            return(oldCard.Value - 1 == newCard.Value);
        }
        public override bool CanMoveToAnotherPile(int whichOne)
        {
            if (PreviousSelected == -1)
            {
                throw new BasicBlankException("There was no card selected");
            }
            if (Piles.HasCardInColumn(whichOne) == false)
            {
                return(true);
            }
            var oldCard = Piles.GetLastCard(whichOne);
            var newCard = Piles.GetLastCard(PreviousSelected);

            return(newCard.Value + 1 == oldCard.Value);
        }
        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);
        }
        public override bool CanAddCard(int pile, SolitaireCard thisCard)
        {
            if (pile > 3)
            {
                return(base.CanAddCard(pile, thisCard));
            }
            //for this; starts from kings and moves down
            if (Piles.HasCard(pile) == false)
            {
                return(thisCard.Value == EnumCardValueList.King);
            }
            var oldCard = Piles.GetLastCard(pile);

            if (oldCard.Suit != thisCard.Suit)
            {
                return(false);
            }
            return(oldCard.Value == thisCard.Value + 1);
        }
        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);
        }
Ejemplo n.º 15
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));
        }
Ejemplo n.º 16
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");
            }
            TempList = ListValidCards();
            var thisPile = Piles.PileList[whichOne];

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

            if (oldCard.Value == EnumCardValueList.LowAce)
            {
                return(false);
            }
            return(TempList.CanMoveCardsRegardlessOfColorOrSuit(oldCard, ref lastOne));
        }
        public override bool CanMoveToAnotherPile(int whichOne)
        {
            var thisCard = Piles.GetLastCard(PreviousSelected);

            return(CanAddSingleCard(whichOne, thisCard));
        }