Exemple #1
0
        public override PredictedResult JudgePredictDataResult(LotteryInfoDto lotteryInfo, PredictDataDto startPeriodData,
                                                               NormConfigDto userNormConfig)
        {
            var planInfo    = _planInfoQueryService.GetPlanInfoById(userNormConfig.PlanId);
            var lotteryData = _lotteryDataQueryService.GetPredictPeriodData(lotteryInfo.Id, startPeriodData.CurrentPredictPeriod);

            if (lotteryData == null)
            {
                return(PredictedResult.Running);
            }
            var lotteryNumber     = new LotteryNumber(lotteryData);
            var rank              = planInfo.PositionInfos.First().Position;
            var lotteryNumberData = lotteryNumber.GetRankNumber(rank);

            if (startPeriodData.PredictedData.Contains(lotteryNumberData.ToString()))
            {
                if (planInfo.DsType == PredictType.Fix)
                {
                    return(PredictedResult.Right);
                }
            }
            else
            {
                if (planInfo.DsType == PredictType.Kill)
                {
                    return(PredictedResult.Right);
                }
            }
            if (startPeriodData.CurrentPredictPeriod >= startPeriodData.EndPeriod)
            {
                return(PredictedResult.Error);
            }
            return(PredictedResult.Running);
        }
Exemple #2
0
        public TimeRuleManager(LotteryInfoDto lotteryInfo)
        {
            _lotteryInfo          = lotteryInfo;
            _timeRuleQueryService = ObjectContainer.Resolve <ITimeRuleQueryService>();

            InitTimeRule();
        }
Exemple #3
0
        public LotterEngine(LotteryInfoDto lotteryInfo)
        {
            _lotteryInfo           = lotteryInfo;
            _timeRuleManager       = new TimeRuleManager(_lotteryInfo);
            _lotteryQueryService   = ObjectContainer.Resolve <ILotteryQueryService>();
            _finalDataQueryService = ObjectContainer.Resolve <ILotteryFinalDataQueryService>();
            _typeFinder            = ObjectContainer.Resolve <ITypeFinder>();

            InitializationPerdictor();
        }
Exemple #4
0
        private async Task InitLotteryPredictTable(LotteryInfoDto lotteryInfo)
        {
            var lotteryPlans  = _planInfoQueryService.GetPlanInfoByLotteryId(lotteryInfo.Id);
            var predictTables = lotteryPlans.Select(p => p.PlanNormTable).ToList();
            var predictDbName = AanalyseDbName(lotteryInfo.LotteryCode);
            var result        = await _commandService.SendAsync(new InitPredictTableCommand(Guid.NewGuid().ToString(), predictDbName, lotteryInfo.LotteryCode, predictTables));

            if (result.Status == AsyncTaskStatus.Success)
            {
                await _commandService.SendAsync(new CompleteDynamicTableCommand(lotteryInfo.Id, true));
            }
        }
Exemple #5
0
 protected RunLotteryAbstractJob()
 {
     PreInitialize();
     LastStart                     = DateTime.Now;
     _lotteryQueryService          = ObjectContainer.Resolve <ILotteryQueryService>();
     _lotteryFinalDataQueryService = ObjectContainer.Resolve <ILotteryFinalDataQueryService>();
     _commandService               = ObjectContainer.Resolve <ICommandService>();
     _lotteryDataQueryService      = ObjectContainer.Resolve <ILotteryDataQueryService>();
     _lotteryInfo                  = _lotteryQueryService.GetLotteryInfoByCode(_lotteryCode);
     _timeRuleManager              = new TimeRuleManager(_lotteryInfo);
     _lotteryFinalData             = _lotteryFinalDataQueryService.GetFinalData(_lotteryInfo.Id);
     _dataUpdateItems              = DataUpdateContext.GetDataUpdateItems(_lotteryInfo.Id);
     _isStart = true;
     PostinItialize();
 }
Exemple #6
0
        public override PredictedResult JudgePredictDataResult(LotteryInfoDto lotteryInfo, PredictDataDto startPeriodData,
                                                               NormConfigDto userNormConfig)
        {
            var planInfo    = _planInfoQueryService.GetPlanInfoById(userNormConfig.PlanId);
            var lotteryData = _lotteryDataQueryService.GetPredictPeriodData(lotteryInfo.Id, startPeriodData.CurrentPredictPeriod);

            if (lotteryData == null)
            {
                return(PredictedResult.Running);
            }
            var lotteryNumber   = new LotteryNumber(lotteryData);
            var lotteryNumCount = lotteryNumber.Datas.Length;
            var lotteryNumbers  = new List <int>();

            foreach (var position in planInfo.PositionInfos)
            {
                var lotteryNumberData = GetLotteryNumberData(lotteryNumber, position.Position, planInfo);
                lotteryNumbers.Add(Convert.ToInt32(lotteryNumberData));
            }

            var predictNumber = startPeriodData.PredictedData.Split(',').Select(p => Convert.ToInt32(p)).ToArray();


            if (userNormConfig.ForecastCount <= lotteryNumCount)
            {
                if (predictNumber.All(p => lotteryNumbers.Contains(p)))
                {
                    return(PredictedResult.Right);
                }
                else if (startPeriodData.CurrentPredictPeriod >= startPeriodData.EndPeriod)
                {
                    return(PredictedResult.Error);
                }
            }
            else
            {
                if (predictNumber.All(p => lotteryNumber.Datas.Contains(p)))
                {
                    return(PredictedResult.Right);
                }
                else if (startPeriodData.CurrentPredictPeriod >= startPeriodData.EndPeriod)
                {
                    return(PredictedResult.Error);
                }
            }
            return(PredictedResult.Running);
        }
Exemple #7
0
        public override PredictedResult JudgePredictDataResult(LotteryInfoDto lotteryInfo, PredictDataDto startPeriodData,
                                                               NormConfigDto userNormConfig)
        {
            var planInfo    = _planInfoQueryService.GetPlanInfoById(userNormConfig.PlanId);
            var lotteryData = _lotteryDataQueryService.GetPredictPeriodData(lotteryInfo.Id, startPeriodData.CurrentPredictPeriod);

            if (lotteryData == null)
            {
                return(PredictedResult.Running);
            }
            var lotteryNumber = new LotteryNumber(lotteryData);

            var sum = 0;

            foreach (var position in planInfo.PositionInfos)
            {
                var lotteryNumberData = GetLotteryNumberData(lotteryNumber, position.Position, planInfo);
                sum += Convert.ToInt32(lotteryNumberData);
            }

            var junzhi = (int)(sum / planInfo.PositionInfos.Count);

            bool isRight;
            var  numPredictData = startPeriodData.PredictedData.Split(',').Select(p => Convert.ToInt32(p));

            if (planInfo.DsType == PredictType.Fix)
            {
                isRight = numPredictData.Contains(junzhi);
            }
            else
            {
                isRight = !numPredictData.Contains(junzhi);
            }
            if (isRight)
            {
                return(PredictedResult.Right);
            }
            else
            {
                if (startPeriodData.CurrentPredictPeriod >= startPeriodData.EndPeriod)
                {
                    return(PredictedResult.Error);
                }
                return(PredictedResult.Running);
            }
        }
Exemple #8
0
        public override PredictedResult JudgePredictDataResult(LotteryInfoDto lotteryInfo, PredictDataDto startPeriodData,
                                                               NormConfigDto userNormConfig)
        {
            var planInfo    = _planInfoQueryService.GetPlanInfoById(userNormConfig.PlanId);
            var lotteryData = _lotteryDataQueryService.GetPredictPeriodData(lotteryInfo.Id, startPeriodData.CurrentPredictPeriod);

            if (lotteryData == null)
            {
                return(PredictedResult.Running);
            }
            var lotteryNumber = new LotteryNumber(lotteryData);

            var  postion           = planInfo.PositionInfos.First().Position;
            var  lotteryNumberData = GetLotteryNumberData(lotteryNumber, postion, planInfo).ToString();
            bool isRight;
            var  numPredictData = startPeriodData.PredictedData.Split(',').Select(p => p.ToString());

            if (planInfo.DsType == PredictType.Fix)
            {
                isRight = numPredictData.Contains(lotteryNumberData);
            }
            else
            {
                isRight = !numPredictData.Contains(lotteryNumberData);
            }
            if (isRight)
            {
                return(PredictedResult.Right);
            }
            else
            {
                if (startPeriodData.CurrentPredictPeriod >= startPeriodData.EndPeriod)
                {
                    return(PredictedResult.Error);
                }
                return(PredictedResult.Running);
            }
        }
Exemple #9
0
 protected BasePredictor(LotteryInfoDto lotteryInfo, AlgorithmType algorithmType)
 {
     _LotteryInfo  = lotteryInfo;
     AlgorithmType = algorithmType;
 }
Exemple #10
0
 public StochasticPredictor(LotteryInfoDto lotteryInfo, AlgorithmType algorithmType) : base(lotteryInfo, algorithmType)
 {
 }
Exemple #11
0
 public override PredictedResult JudgePredictDataResult(LotteryInfoDto lotteryInfo, PredictDataDto startPeriodData,
                                                        NormConfigDto userNormConfig)
 {
     throw new System.NotImplementedException();
 }
Exemple #12
0
 public abstract PredictedResult JudgePredictDataResult(LotteryInfoDto lotteryInfo,
                                                        PredictDataDto startPeriodData,
                                                        NormConfigDto userNormConfig);
Exemple #13
0
 private void InitLotteryInfo()
 {
     _lotteryInfo = _lotteryQueryService.GetLotteryInfoById(_lotterySession.SystemTypeId);
 }
Exemple #14
0
 private IEnumerable <PredictDataDto> PredictNormData(LotteryInfoDto lotteryInfo, NormConfigDto userNorm, int predictPeroid, bool isSwitchFormula = false)
 {
     return(_lotteryPredictDataService.PredictNormData(lotteryInfo.Id, userNorm, predictPeroid, lotteryInfo.LotteryCode, isSwitchFormula));
 }
Exemple #15
0
 public DiscreteMarkovPredictor(LotteryInfoDto lotteryInfo, AlgorithmType algorithmType) : base(lotteryInfo, algorithmType)
 {
 }
Exemple #16
0
 public MockPredictor(LotteryInfoDto lotteryInfo, AlgorithmType algorithmType) : base(lotteryInfo, algorithmType)
 {
 }
Exemple #17
0
 public TemperatureMarkovPredictor(LotteryInfoDto lotteryInfo, AlgorithmType algorithmType) : base(lotteryInfo, algorithmType)
 {
 }