public void PopulateNewCards(IDeckDict <PokerCardInfo> thisList) { DisplayCard thisDisplay; if (PokerList.Count == 0) { CustomBasicList <DisplayCard> newList = new CustomBasicList <DisplayCard>(); if (thisList.Count != 5) { throw new BasicBlankException("Must have 5 cards for the poker hand"); } thisList.ForEach(thisCard => { thisDisplay = new DisplayCard(); thisDisplay.CurrentCard = thisCard; newList.Add(thisDisplay); }); PokerList.ReplaceRange(newList); return; } var tempList = PokerList.Where(items => items.WillHold == false).ToCustomBasicList(); if (tempList.Count != thisList.Count) { throw new BasicBlankException("Mismatch for populating new cards"); } int x = 0; tempList.ForEach(temps => { var thisCard = thisList[x]; temps.CurrentCard = thisCard; x++; }); }
public static DeckRegularDict <SolitaireCard> ListValidCardsSameSuit(this IDeckDict <SolitaireCard> givenList) { int x; int previousNumber = 0; DeckRegularDict <SolitaireCard> output = new DeckRegularDict <SolitaireCard>(); EnumSuitList previousSuit = EnumSuitList.None; for (x = givenList.Count; x >= 1; x += -1) { var thisCard = givenList[x - 1]; if (x == givenList.Count) { previousSuit = thisCard.Suit; previousNumber = (int)thisCard.Value; output.Add(thisCard); } else { if (previousNumber + 1 == (int)thisCard.Value && thisCard.Suit == previousSuit) { output.Add(thisCard); } else { return(output); } previousNumber = (int)thisCard.Value; } } return(output); }
public void LoadDummyCards(IDeckDict <RookCardInformation> thisList, RookMainGameClass mainGame) { if (thisList.Count != 12) { throw new BasicBlankException("Must have 12 cards for dummy cards"); } if (mainGame.PlayerList.Count() == 3) { throw new BasicBlankException("There is no dummy hand because there are 3 players already"); } int x = 0; thisList.ForEach(thisCard => { x++; if (x < 7) { thisCard.IsUnknown = false; } else { thisCard.IsUnknown = true; } }); HandList.ReplaceRange(thisList); }
public static void RemoveTiles(this IDeckDict <ThreeLetterFunCardData> thisList) { foreach (var thisCard in thisList) { thisCard.ClearTiles(); } }
public static DeckRegularDict <SolitaireCard> ListValidCardsAlternateColors(this IDeckDict <SolitaireCard> givenList) { int x; int previousNumber = 0; DeckRegularDict <SolitaireCard> output = new DeckRegularDict <SolitaireCard>(); EnumColorList previousColor = EnumColorList.None; for (x = givenList.Count; x >= 1; x += -1) { var thisCard = givenList[x - 1]; if (x == givenList.Count) { previousColor = thisCard.Color; previousNumber = (int)thisCard.Value; output.Add(thisCard); } else { if (previousNumber + 1 == (int)thisCard.Value && thisCard.Color != previousColor) //i think this was the problem. { output.Add(thisCard); } else { return(output); } previousNumber = (int)thisCard.Value; previousColor = thisCard.Color; } } return(output); }
public bool IsValidRummy(IDeckDict <RegularRummyCard> thisCol, out EnumWhatSets whatType, out bool useSecond) { whatType = EnumWhatSets.kinds; useSecond = false; if (thisCol.Count < 3) { return(false); //you have to have at least 3 cards for a rummy. } bool rets; var newList = thisCol.ToRegularDeckDict(); rets = _rummys !.IsNewRummy(newList, thisCol.Count, RummyProcesses <EnumSuitList, EnumColorList, RegularRummyCard> .EnumRummyType.Sets); if (rets == true) { return(true); } rets = _rummys.IsNewRummy(newList, thisCol.Count, RummyProcesses <EnumSuitList, EnumColorList, RegularRummyCard> .EnumRummyType.Runs); if (rets == true) { whatType = EnumWhatSets.runs; useSecond = _rummys.UseSecond; return(true); } return(false); }
public override void ClearBoard(IDeckDict <SolitaireCard> thisCol) { base.ClearBoard(thisCol); //below is custom code. int x; int y = 0; for (x = 1; x <= 6; x++) { foreach (var thisPile in Piles.PileList) { thisPile.TempList.Add(thisCol[y]); y += 1; } } foreach (var thisPile in Piles.PileList) { thisPile.CardList.ReplaceRange(thisPile.TempList); if (thisPile.CardList.Count > 6) { throw new BasicBlankException("The card list cannot be more than 6 to start with."); } } }
public void LoadBarCards(IDeckDict <SnagCardGameCardInformation> thisList) { if (_wasSaved == false && thisList.Count != 5) { throw new BasicBlankException("Must have 5 cards for the bar."); } if (_wasSaved == true && thisList.Count > 5) { throw new BasicBlankException("The bar can never have more than 5 cards"); } bool rets = NeedsReverse(); if (rets == true) { thisList.Reverse(); } DeckRegularDict <SnagCardGameCardInformation> tempList = new DeckRegularDict <SnagCardGameCardInformation>(); thisList.ForEach(thisCard => { var newCard = new SnagCardGameCardInformation(); newCard.Populate(thisCard.Deck); newCard.Angle = EnumRotateCategory.RotateOnly90; tempList.Add(newCard); }); HandList.ReplaceRange(tempList); }
public void ReshuffleFirstObjects(IDeckDict <D> thisList, int startAt, int endAt) { CheckRandom(); int x = 0; int index; int ask1; endAt = endAt - thisList.Count + 1; int increasedEnd = 0; thisList.ForEach(items => { index = _privateDict.IndexOf(items); if (index <= endAt) { increasedEnd++; } }); endAt += increasedEnd; thisList.ForEach(items => { index = _privateDict.IndexOf(items); if (index == -1) { throw new BasicBlankException("Item not found to reshuffle the card"); } if (index < startAt || index > endAt) { ask1 = _rs !.GetRandomNumber(endAt, startAt); _privateDict.MoveItem(items, ask1); } x++; endAt--; }); }
public void AddSeveralCards(IDeckDict <D> whatList) { if (whatList.Count == 0) { return; } DeckRegularDict <D> newList = new DeckRegularDict <D>(); if (CurrentCard.Deck > 0) { newList.Add(CurrentCard); } CurrentCard = whatList.Last(); CurrentCard.IsUnknown = false; CurrentCard.IsSelected = false; CurrentCard.Drew = false; int x; for (x = whatList.Count - 1; x >= 1; x += -1) { whatList[x - 1].IsSelected = false; whatList[x - 1].Drew = false; // i think newList.Add(whatList[x - 1]); } _objectList.AddRange(newList); _previousNum = _objectList.Count; // i think }
public static CustomBasicList <ICard> GetInterfaceList(this IDeckDict <YahtzeeHandsDownCardInformation> thisList) { CustomBasicList <ICard> output = new CustomBasicList <ICard>(); output.AddRange(thisList); return(output); }
public DeckRegularDict <RegularRummyCard> AppendDiscardList(IDeckDict <RegularRummyCard> thisCol) { DeckRegularDict <RegularRummyCard> output = new DeckRegularDict <RegularRummyCard>(); output.AddRange(thisCol); output.AddRange(SingleInfo !.MainHandList); return(output); }
public void InsertBeginningCards(IDeckDict <D> testCards) //this is needed in cases where we need some cards to be at the beginning of the deck. one hint was tee it up. { testCards.ForEach(tempCard => { var ourCard = _objectList.GetSpecificItem(tempCard.Deck); _objectList.RemoveSpecificItem(ourCard); _objectList.InsertBeginning(tempCard); }); }
public void AddRestOfDeck(IDeckDict <D> currentList) { if (currentList.ObjectExist(_objectList.First().Deck)) { _objectList.RemoveFirstItem(); //try to remove the first item. hopefully does not cause another issue. } _objectList.AddRange(currentList); _previousNum = _objectList.Count; // so far should be fine }
public static DeckRegularDict <T> GetLoadedCards <T>(this IDeckDict <T> thisList, PlayerCollection <LifeBoardGamePlayerItem> playerList) where T : LifeBaseCard, new() { var tempList = thisList.GetCardsLeft(playerList); tempList.ForEach(thisCard => thisCard.IsUnknown = true); tempList.ShuffleList(); return(tempList); }
public static void SelectMaxOne <D>(this IDeckDict <D> thisList, D thisItem) where D : IDeckObject { if (thisItem.IsSelected == true) { thisItem.IsSelected = false; return; } thisList.ForEach(items => items.IsSelected = false); thisItem.IsSelected = true; }
public override void ClearBoard(IDeckDict <SolitaireCard> thisCol) { base.ClearBoard(thisCol); int x = 0; Discards !.PileList !.ForEach(thisPile => { thisPile.ObjectList.Add(thisCol[x]); x++; }); }
private static A8RoundRummyCardInformation GetLastCard(this IDeckDict <A8RoundRummyCardInformation> originalList, IDeckDict <A8RoundRummyCardInformation> newList) { if (originalList.Count != 8 && newList.Count != 7) { throw new BasicBlankException("The original list must have 8 cards and the new list must have 7 cards"); } return(originalList.Single(ThisCard => { return newList.ObjectExist(ThisCard.Deck) == false; })); }
public static DeckRegularDict <C> GetMailOrDealList <C>(this IDeckDict <CardInformation> tempList, EnumCardCategory whichType) where C : CardInformation, new() { var firstList = tempList.Where(items => items.CardCategory == whichType); DeckRegularDict <C> output = new DeckRegularDict <C>(); foreach (var thisItem in firstList) { output.Add((C)thisItem); } return(output); }
public override void ClearBoard(IDeckDict <SolitaireCard> thisCol) { base.ClearBoard(thisCol); //below is custom code. int x = 0; Discards !.PileList !.ForEach(thisPile => { thisPile.ObjectList.Add(thisCol[x]); //has to be 0 based. x++; }); }
public void PopulateObjects(IDeckDict <D> thisList) // try just t (if regularcardinfo; then that will be the list. knows it has to be at least baseimages.cardinfo { if (IgnoreMaxRules == false) { if (thisList.Count > Maximum && Maximum > 0) { throw new BasicBlankException("The maximum objects allowed are " + Maximum); } } HandList.ReplaceRange(thisList); // i think its being replace. if its different, can fix AfterPopulateObjects(); }
public void AddCards(int whichOne, IDeckDict <R> cardList) { var tempList = SelectedObjectsRemoved(); cardList.AddRange(tempList); if (cardList.Count == 0) { return; } SetList[whichOne - 1].AddCards(cardList); PublicCount(); }
public void AddNewSet(IDeckDict <RegularRummyCard> thisCol) { if (thisCol.Count != 3) { throw new BasicBlankException("You must have 3 cards to add to a set"); } thisCol.UnhighlightObjects(); SetInfo thisSet = new SetInfo(_gameContainer.Command); thisSet.HandList.AddRange(thisCol); SetList.Add(thisSet); }
public static bool GuaranteedVictory(this IDeckDict <A8RoundRummyCardInformation> cardList, A8RoundRummyMainGameClass mainGame) { mainGame.LastSuccessful = false; mainGame.LastCard = null; if (mainGame.SaveRoot !.RoundList.Last().Rummy != EnumRummyType.Kinds) { return(false); //only last round has this. } if (cardList.Count(Items => Items.CardType != EnumCardType.Regular) > 1) { return(false); } var tempList = cardList.Where(Items => Items.CardType == EnumCardType.Regular).GroupBy(Items => Items.Value).ToCustomBasicList(); if (tempList.Count == 1) { if (tempList.First().Count() >= 7) { var finList = tempList.Single().Take(7).ToRegularDeckDict(); mainGame.LastSuccessful = true; mainGame.LastCard = cardList.GetLastCard(finList); return(true); } return(false); } if (tempList.Count > 2) { return(false); } if (tempList.First().Count() < 7 && tempList.Last().Count() < 7) { return(false); } if (tempList.First().Count() >= 7) { var finList = tempList.First().Take(7).ToRegularDeckDict(); mainGame.LastSuccessful = true; mainGame.LastCard = cardList.GetLastCard(finList); return(true); } else { if (tempList.Last().Count() < 7) { throw new BasicBlankException("Had to have 7"); } var finList = tempList.Last().Take(7).ToRegularDeckDict(); mainGame.LastSuccessful = true; mainGame.LastCard = cardList.GetLastCard(finList); return(true); } }
public async Task CreateNewSetAsync(IDeckDict <RegularRummyCard> thisCol, EnumWhatSets setType, bool useSecond) { DeckRegularDict <RegularRummyCard> newCol = new DeckRegularDict <RegularRummyCard>(); thisCol.ForEach(ThisCard => newCol.Add(SingleInfo !.MainHandList.GetSpecificItem(ThisCard.Deck))); SingleInfo !.MainHandList.RemoveGivenList(newCol, System.Collections.Specialized.NotifyCollectionChangedAction.Remove); RummySet thisSet = new RummySet(_gameContainer !); thisSet.CreateNewSet(thisCol, setType, useSecond); _model !.MainSets1 !.CreateNewSet(thisSet); UpdatePoints(); await ContinueTurnAsync(); }
public override void ClearBoard(IDeckDict <SolitaireCard> thisCol) { base.ClearBoard(thisCol); //below is custom code. int x = 0; Discards !.PileList !.ForEach(thisPile => { thisPile.ObjectList.Add(thisCol[x]); x++; }); CardList.ReplaceRange(thisCol); // i think. }
//private void FinishClearing() //{ // thisMod!.GolfHand1!.Visible = false; // thisMod.HiddenCards1!.Visible = false; // thisMod.KnockedVisible = false; // thisMod.Deck1!.Visible = false; // thisMod.Pile1!.Visible = false; // thisMod.Pile2!.Visible = false; // thisMod.ChooseFirstCardsVisible = true; // Visible = true; // IsEnabled = true; //} public void ClearBoard(IDeckDict <RegularSimpleCard> thisList) { if (thisList.Count != 4) { throw new BasicBlankException("The card list must have 4 cards"); } thisList.ForEach(thisCard => { thisCard.IsUnknown = true; }); ObjectList.ReplaceRange(thisList); //FinishClearing(); }
public void CreateNewSet(IDeckDict <RegularRummyCard> thisCol) { if (thisCol.Count < 2 || thisCol.Count > 4) { throw new BasicBlankException("A set must have 2 to 4 cards"); } _player = _gameContainer.WhoTurn; thisCol.ForEach(thisCard => { thisCard.Drew = false; thisCard.IsSelected = false; }); HandList.ReplaceRange(thisCol); }
public void CreateSet(IDeckDict <MonasteryCardInfo> thisCol, EnumWhatSets whatSet) { _setType = whatSet; DeckRegularDict <MonasteryCardInfo> tempList = new DeckRegularDict <MonasteryCardInfo>(); thisCol.ForEach(thisCard => { var newCard = new MonasteryCardInfo(); newCard.Populate(thisCard.Temp); //hopefully this works. newCard.Deck = thisCard.Deck; tempList.Add(newCard); }); HandList.ReplaceRange(tempList); }
public void ClearBoard(IDeckDict <SolitaireCard> thisCol) { if (thisCol.Count != CardsNeededToBegin) { throw new BasicBlankException($"Needs {CardsNeededToBegin}, not {thisCol.Count}"); } if (thisCol.Any(items => items.Value != EnumCardValueList.Queen)) { throw new BasicBlankException("Only queens can be used"); } thisCol.First().Angle = EnumRotateCategory.RotateOnly90; thisCol[2].Angle = EnumRotateCategory.RotateOnly90; CardList.ReplaceRange(thisCol); }