public void Redeal() { TempList = new DeckRegularDict <SolitaireCard>(); if (DealNumber == 3) { throw new BasicBlankException("There are only 3 deals allowed. Therefore, there is a problem"); } var thisCol = new DeckRegularDict <SolitaireCard>(); DealNumber++; Piles.PileList.ForEach(thisPile => { thisPile.CardList.ForEach(thisCard => thisCol.Add(thisCard)); }); Piles.ClearBoard(); thisCol.ShuffleList(); int y = 0; 8.Times(x => { foreach (var thisPile in Piles.PileList) { if (y == thisCol.Count) { break; } var tempCard = thisCol[y]; thisPile.CardList.Add(tempCard); y++; } }); PreviousSelected = -1; }
public override void ClearBoard(IDeckDict <SolitaireCard> thisList) { if (thisList.Count != CardsNeededToBegin) { throw new BasicBlankException($"Needs {CardsNeededToBegin} not {thisList.Count}"); } if (CardsNeededToBegin != 4) { throw new BasicBlankException("Cards To begin with must be 4"); } _thisMod.Score = thisList.Count; Piles.ClearBoard(); var tempList = Piles.PileList.Skip(4).ToCustomBasicList(); if (tempList.Count == 0) { throw new BasicBlankException("There has to be 4 more piles left. Rethink"); } tempList.ForEach(thisPile => { thisPile.ObjectList.Add(thisList[tempList.IndexOf(thisPile)]); }); }