Ejemplo n.º 1
0
        public static long ToInitialState(this QuistisPattern pattern)
        {
            switch (pattern)
            {
            case QuistisPattern.Elastoid:
                return(0x1de5_b942);

            case QuistisPattern.Malboro:
                return(0x963c_b5e4);

            case QuistisPattern.Wedge:
                return(0x1f13_2481);

            default:
                throw new ArgumentOutOfRangeException(nameof(pattern), pattern, "Invalid pattern: " + pattern);
            }
        }
Ejemplo n.º 2
0
        public static List <CardFormation> CreateOpeningTable(long from, long to, QuistisPattern pattern, SearchType type = SearchType.First, int increment = 0)
        {
            long size = to + 1;

            List <long> rngStateArray = new List <long>();

            switch (type)
            {
            case SearchType.First:
                //CardRng cardRng = new CardRng(null, SearchType.First);
                break;

            case SearchType.Counting:
                CardRng cardRng  = new CardRng(pattern.ToInitialState(), SearchType.Counting);
                long    maxIndex = InputArguments.Count.Value + Settings.CountingWidth;

                for (int i = 0; i < maxIndex; i++)
                {
                    cardRng.GetNextState();
                    rngStateArray.Add(cardRng.State + increment);
                }
                break;
            }

            int[] offsetArray = new int[Settings.CountingWidth];
            switch (type)
            {
            case SearchType.Counting:
                offsetArray = new int[Settings.CountingWidth];
                for (int i = 0; i < offsetArray.Length; i++)
                {
                    offsetArray[i] = i - Settings.CountingWidth / 2;
                }
                break;
            }



            int index = -1;
            List <CardFormation> formations = new List <CardFormation>();

            for (int i = 0; i <= to; i++)
            {
                if (i < from || i > to)
                {
                    continue;
                }

                foreach (int offset in offsetArray)
                {
                    var rngState = (rngStateArray[i] + offset) & 0xffff_ffff;
                    formations.Add(new CardFormation
                    {
                        Cards  = GetOpeningCards(rngState, true),
                        Index  = index,
                        Offset = offset
                    });
                }
            }

            //foreach (int offset in offsetArray)
            //{
            //    index++;
            //    long rngState = rngStateArray[index] + offset & 0xffff_ffff;
            //    formations.Add(new CardFormation
            //    {
            //        Cards = GetOpeningCards(rngState, true),
            //        Index = index,
            //        Offset = offset
            //    });
            //}



            return(formations);
        }