Exemplo n.º 1
0
 public virtual void ClearBoard()
 {
     _listUnknownCards.Clear(); //try this instead.  hopefully still okay.
     PileList.ForEach(thisPile =>
     {
         thisPile.CardList.Clear();
         thisPile.TempList.Clear(); //i think this is needed too.
         thisPile.IsSelected = false;
     });
 }
 public DeckRegularDict <D> GetObjectsInOrderSelected(bool alsoRemove)
 {
     if (alsoRemove == true)
     {
         _ = ListSelectedObjects(true);
         var newList = _orderOfObjectsSelectedList.ToRegularDeckDict();
         _orderOfObjectsSelectedList.Clear();
         return(newList);
     }
     return(_orderOfObjectsSelectedList.ToRegularDeckDict());
 }
        protected override Task StartSetUpAsync(bool isBeginning)
        {
            LoadControls();
            PlayerList !.ForEach(thisPlayer =>
            {
                thisPlayer.WonLastRound = "";
                thisPlayer.ScoreRound   = 0;
                thisPlayer.TotalScore   = 0;
            });
            DeckRegularDict <ComboCardInfo> tempList = new DeckRegularDict <ComboCardInfo>();

            6.Times(x =>
            {
                ComboCardInfo thisCard = new ComboCardInfo();
                thisCard.Populate(x);
                if (Test !.DoubleCheck == false || x == 6)
                {
                    tempList.Add(thisCard);
                }
            });

            _model !.ComboHandList !.HandList.ReplaceRange(tempList);
            _gameContainer.AlreadyDrew  = false;
            SaveRoot !.ExtraTurns       = 0;
            SaveRoot.FirstPlayerWentOut = 0;
            _chanceList.Clear();
            12.Times(x =>
            {
                ChanceCardInfo thisCard = new ChanceCardInfo();
                thisCard.Populate(x);
                _chanceList.Add(thisCard);
            });
            _chanceList.ShuffleList();
            return(base.StartSetUpAsync(isBeginning));
        }
        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);
        }
 internal async Task NewRoundAsync()
 {
     _model !.IsRoundOver = false;
     _model.Winnings      = 0;
     _model.HandLabel     = "Nothing";
     _model.PokerList.Clear();
     _model.BetPlaced = false;
     _model.Round++;
     _cardList.Clear();
     await base.NewGameAsync(_model.DeckPile);
 }
Exemplo n.º 6
0
        private void GenerateList()
        {
            _list.Clear();
            int x, y, z, q = 0;

            for (x = 1; x <= ThisInfo !.HowManyDecks; x++)
            {
                for (y = 0; y < ThisInfo.SuitList.Count; y++)
                {
                    for (z = ThisInfo.LowestNumber; z <= ThisInfo.HighestNumber; z++)
                    {
                        if (CanUse(ThisInfo.SuitList[y], z))
                        {
                            q++;

                            RegularSimpleCard card = new RegularSimpleCard();
                            card.Deck = q;
                            card.Suit = ThisInfo.SuitList[y];
                            if (z == 1 || z == 14)
                            {
                                PopulateAceValue();
                            }
                            else
                            {
                                Value = (EnumCardValueList)z;
                            }
                            card.Value    = Value;
                            card.Section  = x;
                            card.CardType = EnumCardTypeList.Regular;
                            if (card.Suit == EnumSuitList.Clubs || card.Suit == EnumSuitList.Spades)
                            {
                                card.Color = EnumColorList.Black;
                            }
                            else
                            {
                                card.Color = EnumColorList.Red;
                            }
                            _list.Add(card);
                        }
                    }
                }
            }
            if (ThisInfo.UseJokers == true)
            {
                for (int r = 1; r <= ThisInfo.HowManyDecks; r++)
                {
                    for (int p = 1; p <= 2; p++)
                    {
                        q++;
                        RegularSimpleCard card = new RegularSimpleCard();
                        card.Value    = EnumCardValueList.Joker;
                        card.Deck     = q;
                        card.CardType = EnumCardTypeList.Joker;
                        if (p == 1)
                        {
                            card.Color = EnumColorList.Black;
                        }
                        else
                        {
                            card.Color = EnumColorList.Red;
                        }
                        card.Section = r;
                        _list.Add(card);
                    }
                }
                EnumColorList last = EnumColorList.Red;
                int           s    = ThisInfo.HowManyDecks;
                for (int i = 0; i < ThisInfo.GetExtraJokers; i++)
                {
                    q++;
                    if (last == EnumColorList.Red)
                    {
                        last = EnumColorList.Black;
                    }
                    else
                    {
                        last = EnumColorList.Red;
                    }
                    s++;
                    if (s > ThisInfo.HowManyDecks)
                    {
                        s = 1;
                    }
                    RegularSimpleCard card = new RegularSimpleCard();
                    card.Value    = EnumCardValueList.Joker;
                    card.Deck     = q;
                    card.CardType = EnumCardTypeList.Joker;
                    card.Section  = s;
                    card.Color    = last;
                    _list.Add(card);
                }
            }
        }