コード例 #1
0
        //if i can't ask for it to begin with, do here for rummys.
        public bool IsAcceptableSet()
        {
            if (HandList.Count < 3)
            {
                return(false);
            }
            var thisList = HandList.ToRegularDeckDict();

            if (thisList.Count(items => items.IsJoker) > 1)
            {
                return(false); //each set can only have one joker
            }
            var wildList = GetWildList(thisList);

            if (wildList.Count == 1)
            {
                if (_isNew)
                {
                    if (thisList.Count(items => items.IsJoker == false && items.WhatDraw == EnumDrawType.FromHand) < 2)
                    {
                        return(false); //because needs 2 from hand.
                    }
                }
            }
            var newRummy = HandList.ToRegularDeckDict();

            if (_setType == EnumWhatSets.Runs)
            {
                return(_rummys.IsNewRummy(newRummy, newRummy.Count, RummyProcesses <EnumColorType, EnumColorType, TileInfo> .EnumRummyType.Runs));
            }
            return(_rummys.IsNewRummy(newRummy, newRummy.Count, RummyProcesses <EnumColorType, EnumColorType, TileInfo> .EnumRummyType.Sets));
        }
コード例 #2
0
        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);
        }