private int BonusPoints(RackoPlayerItem thisPlayer) { RummyProcesses <EnumSuitList, EnumSuitList, RackoCardInformation> thisInfo = new RummyProcesses <EnumSuitList, EnumSuitList, RackoCardInformation>(); thisInfo.HasSecond = false; thisInfo.HasWild = false; thisInfo.NeedMatch = false; //try this too. thisInfo.LowNumber = 1; RackoDeckCount temps = MainContainer.Resolve <RackoDeckCount>(); thisInfo.HighNumber = temps.GetDeckCount(); DeckRegularDict <RackoCardInformation> tempCol = thisPlayer.MainHandList.ToRegularDeckDict(); var newColls = thisInfo.WhatNewRummy(tempCol, 6, RummyProcesses <EnumSuitList, EnumSuitList, RackoCardInformation> .EnumRummyType.Runs, true); if (newColls.Count > 0) { return(400); } newColls = thisInfo.WhatNewRummy(tempCol, 5, RummyProcesses <EnumSuitList, EnumSuitList, RackoCardInformation> .EnumRummyType.Runs, true); if (newColls.Count > 0) { return(200); } newColls = thisInfo.WhatNewRummy(tempCol, 4, RummyProcesses <EnumSuitList, EnumSuitList, RackoCardInformation> .EnumRummyType.Runs, true); if (newColls.Count > 0) { return(100); } newColls = thisInfo.WhatNewRummy(tempCol, 3, RummyProcesses <EnumSuitList, EnumSuitList, RackoCardInformation> .EnumRummyType.Runs, true); if (newColls.Count > 0) { return(50); } return(0); }
private int HowManyPairs(IDeckDict <CribbageCard> thisCol) { var newCol = thisCol.ToRegularDeckDict(); int output = 0; CribbageCard newCard; DeckRegularDict <CribbageCard> finals = new DeckRegularDict <CribbageCard>(); newCol.Add(StartCard()); newCol.RemoveAllOnly(items => items.HasUsed); var whatNewRummy = _rummys !.WhatNewRummy(newCol, 2, RummyProcesses <EnumSuitList, EnumColorList, CribbageCard> .EnumRummyType.Sets, false); if (whatNewRummy.Count == 0) { return(0); } if (whatNewRummy.Count > 2) { finals.AddRange(newCol); newCard = whatNewRummy.First(); finals.KeepConditionalItems(items => items.Value != newCard.Value); newCol.Clear(); newCol.AddRange(finals); whatNewRummy = _rummys.WhatNewRummy(newCol, 2, RummyProcesses <EnumSuitList, EnumColorList, CribbageCard> .EnumRummyType.Sets, false); if (whatNewRummy.Count == 0) { return(0); } finals.Clear(); } output++; newCard = whatNewRummy.First(); finals.Clear(); finals.AddRange(newCol); finals.KeepConditionalItems(items => items.Value != newCard.Value); //i think newCol.Clear(); newCol.AddRange(finals); whatNewRummy = _rummys.WhatNewRummy(newCol, 2, RummyProcesses <EnumSuitList, EnumColorList, CribbageCard> .EnumRummyType.Sets, false); if (whatNewRummy.Count == 0) { return(output); } if (whatNewRummy.Count > 2) { return(output); } return(output + 1); }