public DeckRegularDict <D> GetObjectsInOrderSelected(bool alsoRemove) { if (alsoRemove == true) { _ = ListSelectedObjects(true); var newList = _orderOfObjectsSelectedList.ToRegularDeckDict(); _orderOfObjectsSelectedList.Clear(); return(newList); } return(_orderOfObjectsSelectedList.ToRegularDeckDict()); }
private int SpecialCard(DeckRegularDict <UnoCardInformation> moveList, string whatLabel) { var tempList = moveList.ToRegularDeckDict(); if (whatLabel == "Draw 2") { tempList.KeepConditionalItems(x => x.WhichType == EnumCardTypeList.Draw2); } else if (whatLabel == "Skip") { tempList.KeepConditionalItems(x => x.WhichType == EnumCardTypeList.Skip); } else if (whatLabel == "Reverse") { tempList.KeepConditionalItems(x => x.WhichType == EnumCardTypeList.Reverse); } else if (whatLabel == "Wild Draw 4") { tempList.KeepConditionalItems(x => x.Draw == 4); } else if (whatLabel == "Wild") { tempList.KeepConditionalItems(x => x.Draw == 0 && x.WhichType == EnumCardTypeList.Wild); } else { throw new BasicBlankException($"Cannot find any special card to attempt for {whatLabel}"); } if (tempList.Count == 0) { return(0); } return(tempList.GetRandomItem().Deck); }
private DeckRegularDict <MonasteryCardInfo> PopulateTempCol(DeckRegularDict <MonasteryCardInfo> thisCol, out DeckRegularDict <MonasteryCardInfo> aceList) { aceList = thisCol.Where(items => items.Value == EnumCardValueList.LowAce || items.Value == EnumCardValueList.HighAce).ToRegularDeckDict(); DeckRegularDict <MonasteryCardInfo> output = thisCol.ToRegularDeckDict(); output.RemoveGivenList(aceList, System.Collections.Specialized.NotifyCollectionChangedAction.Remove); return(output); //hopefully this works. }
private int ColorMatches(DeckRegularDict <UnoCardInformation> moveList) { var tempList = moveList.ToRegularDeckDict(); //to make a copy. tempList.KeepConditionalItems(Items => Items.Color == _gameContainer.SaveRoot.CurrentColor); if (tempList.Count == 0) { return(0); } return(tempList.OrderByDescending(Items => Items.Points).Take(1).Single().Deck); }
private int NumberMatches(DeckRegularDict <UnoCardInformation> moveList) { UnoCardInformation currents; currents = _model.Pile1.CurrentCard; if (currents.Number == -4) { return(0); } var TempList = moveList.ToRegularDeckDict(); TempList.KeepConditionalItems(Items => Items.Number == currents.Number); if (TempList.Count == 0) { return(0); } return(TempList.GetRandomItem().Deck); }
public bool HasValidSet(DeckRegularDict <TileInfo> thisCol, out int firstNumber, out int secondNumber) { firstNumber = -1; secondNumber = -1; //until proven. if (thisCol.Count < 3) { return(false); } if (thisCol.Count(items => items.IsJoker == true) > 1) { return(false); //can only use one joker for each set. } if (thisCol.Count > 2) { var newCol = thisCol.ToRegularDeckDict(); if (_rummys !.IsNewRummy(newCol, newCol.Count, RummyProcesses <EnumColorType, EnumColorType, TileInfo> .EnumRummyType.Runs)) { firstNumber = _rummys.FirstUsed; secondNumber = _rummys.FirstUsed + thisCol.Count - 1; return(true); } } return(IsKinds(thisCol)); }
private PokerData GetPokerInfo() { PokerData output = new PokerData(); ScoreInfo scores = new ScoreInfo(); scores.CardList = _cardList.ToRegularDeckDict(); if (scores.IsRoyalFlush()) { output.Message = "Royal flush"; output.Mults = 128; return(output); } if (scores.IsStraightFlush()) { output.Message = "Straight flush"; output.Mults = 64; return(output); } if (scores.Kinds(4)) { output.Message = "Four of a kind"; output.Mults = 32; return(output); } if (scores.IsFullHouse()) { output.Message = "Full house"; output.Mults = 16; return(output); } if (scores.IsFlush()) { output.Message = "Flush"; output.Mults = 8; return(output); } if (scores.IsStraight()) { output.Message = "Straight"; output.Mults = 4; return(output); } if (scores.Kinds(3)) { output.Message = "Three of a kind"; output.Mults = 2; return(output); } if (scores.MultiPair()) { output.Message = "Two pairs"; output.Mults = 1; return(output); } if (scores.Kinds(2)) { output.Message = "Pair"; output.Mults = 0; return(output); } if (scores.HasAce()) { output.Message = "High card ace"; output.Mults = -0.5m; return(output); } output.Message = "Nothing"; output.Mults = -1; return(output); }