예제 #1
0
        public void FirstTest()
        {
            var expected = new[] { 1, 2, 3, 4, 5, 1, 2 };
            var actual   = _combination.Element(0);

            Assert.IsTrue(expected.SequenceEqual(actual));
        }
예제 #2
0
        public List <IData> ToPatternMatches(BaseData <int>[] toArray, ICombination <int> model)
        {
            decimal index = model.GetIndexOf(toArray.Select(x => x.Data).ToArray(), Comparer <int> .Default);

            int[] actual = model.Element(index);
            Dictionary <string, string> patterns =
                new Dictionary <string, string>
            {
                { FeatureNames.FiboPattern, GetFiboPattern(actual) },
                { FeatureNames.PrimePattern, GetPrimePattern(actual) },
                { FeatureNames.PrimeCount, GetCount(GetPrimePattern(actual), model) },
                { FeatureNames.FiboCount, GetCount(GetFiboPattern(actual), model) }
            };

            return(patterns.Select(x => new FeatureData <string>(x.Key, x.Value) as IData).ToList());
        }
예제 #3
0
 private static void Print(LottoAggregate leftValue, ICombination <int> mainModel, string name)
 {
     Console.WriteLine(string.Join(",", mainModel.Element(leftValue.Data[name])));
 }
예제 #4
0
        public IEnumerable <IData> GetPossiblePredictions(IEnumerable <string> fibBins, ICombination <int> model)
        {
            List <decimal>            predictions     = new List <decimal>();
            List <string>             fibBinList      = new List <string>(fibBins.Select(x => x.Replace("-", "")));
            List <string>             genFibBinList   = new List <string>();
            List <IEnumerable <int> > predictionDraws = new List <IEnumerable <int> >();

            List <IData> draws = new List <IData>();

            int  k       = fibBinList.Count - 1;
            int  j       = 0;
            bool forward = true;

            while (k >= 0)
            {
                if (k < fibBinList[0].Length)
                {
                    break;
                }
                int    p     = 0;
                string first = string.Empty;
                for (int i = k; i >= 0; i--)
                {
                    first = first + fibBinList[i][j];
                    if (forward)
                    {
                        j++;
                        if (j == fibBinList[i].Length)
                        {
                            break;
                        }
                    }

                    else
                    {
                        j--;
                        if (j == -1)
                        {
                            break;
                        }
                    }

                    p++;
                }
                k = k - p;
                if (forward)
                {
                    j--;
                }
                else
                {
                    j = 0;
                }

                forward = !forward;
                decimal result = FibBinToDec(first);
                if (result < model.TotalCombinations)
                {
                    predictions.Add(result);
                    genFibBinList.Add(first);
                    predictionDraws.Add(model.Element(result));

                    draws.Add(CreateDraw(model.Element(result).ToList(), model));
                }
            }
            return(draws);
        }