public DeckRegularDict <MonasteryCardInfo> EvenOddList(DeckRegularDict <MonasteryCardInfo> thisCol) { var tempCol = PopulateTempCol(thisCol, out DeckRegularDict <MonasteryCardInfo> aceList); DeckRegularDict <MonasteryCardInfo> output = new DeckRegularDict <MonasteryCardInfo>(); if (aceList.Count == 0) { return(thisCol); } if (tempCol.Count == 0) { return(aceList); } var thisCard = tempCol.First(); int numberNeeded = (int)thisCard.Value; //i like the idea that even if aces are there it will hide them even in this case. aceList.Count.Times(x => { thisCard = EntireList.First(items => items.Suit == EnumSuitList.Diamonds && (int)items.Value == numberNeeded); var nextCard = new MonasteryCardInfo(); nextCard.Populate(thisCard.Deck); nextCard.Temp = thisCard.Deck; nextCard.Deck = aceList[x - 1].Deck; //to stop the linking problems. tempCol.Add(nextCard); }); return(tempCol); }
public DeckRegularDict <MonasteryCardInfo> RunList(DeckRegularDict <MonasteryCardInfo> thisCol, EnumRunType runType) { var tempCol = PopulateTempCol(thisCol, out DeckRegularDict <MonasteryCardInfo> aceList); DeckRegularDict <MonasteryCardInfo> output = new DeckRegularDict <MonasteryCardInfo>(); var thisCard = tempCol.First(); int minNumber = (int)thisCard.Value; int maxNumber = minNumber + thisCol.Count - 1; if (maxNumber > 13) { thisCard = tempCol.Last(); maxNumber = (int)thisCard.Value; minNumber = maxNumber - thisCol.Count + 1; } EnumSuitList suitNeeded; if (runType == EnumRunType.Color) { if (thisCard.Color == EnumColorList.Red) { suitNeeded = EnumSuitList.Diamonds; } else { suitNeeded = EnumSuitList.Clubs; } } else if (runType == EnumRunType.Suit) { suitNeeded = thisCard.Suit; } else { suitNeeded = EnumSuitList.Diamonds; } int currentNum = minNumber; thisCol.Count.Times(x => { if (tempCol.Any(items => (int)items.Value == currentNum) == false) { thisCard = EntireList.First(items => items.Suit == suitNeeded && (int)items.Value == currentNum); var nextCard = new MonasteryCardInfo(); nextCard.Populate(thisCard.Deck); nextCard.Temp = thisCard.Deck; //this too i think. nextCard.Deck = aceList.First().Deck; //this is what i had to do now. aceList.RemoveFirstItem(); //has to use the deck of the ace to stop the id problems. output.Add(nextCard); } else { thisCard = tempCol.Single(items => (int)items.Value == currentNum); tempCol.RemoveSpecificItem(thisCard); output.Add(thisCard); } currentNum++; }); return(output); }
public DeckRegularDict <MonasteryCardInfo> KindList(DeckRegularDict <MonasteryCardInfo> thisCol, bool needColor) { var tempCol = PopulateTempCol(thisCol, out DeckRegularDict <MonasteryCardInfo> aceList); DeckRegularDict <MonasteryCardInfo> output = new DeckRegularDict <MonasteryCardInfo>(); if (aceList.Count == 0) { return(thisCol); } if (tempCol.Count == 0) { return(aceList); } var thisCard = tempCol.First(); int numberNeeded = (int)thisCard.Value; EnumSuitList suitNeeded; if (needColor) { if (thisCard.Color == EnumColorList.Red) { suitNeeded = EnumSuitList.Diamonds; } else { suitNeeded = EnumSuitList.Clubs; } } else { suitNeeded = EnumSuitList.Diamonds; } aceList.Count.Times(x => { thisCard = EntireList.First(items => items.Suit == suitNeeded && (int)items.Value == numberNeeded); var nextCard = new MonasteryCardInfo(); nextCard.Populate(thisCard.Deck); //needs to clone it. nextCard.Temp = thisCard.Deck; nextCard.Deck = aceList[x - 1].Deck; //this is what i had to do now. tempCol.Add(nextCard); }); return(tempCol); }