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); }
public TimeRuleManager(LotteryInfoDto lotteryInfo) { _lotteryInfo = lotteryInfo; _timeRuleQueryService = ObjectContainer.Resolve <ITimeRuleQueryService>(); InitTimeRule(); }
public LotterEngine(LotteryInfoDto lotteryInfo) { _lotteryInfo = lotteryInfo; _timeRuleManager = new TimeRuleManager(_lotteryInfo); _lotteryQueryService = ObjectContainer.Resolve <ILotteryQueryService>(); _finalDataQueryService = ObjectContainer.Resolve <ILotteryFinalDataQueryService>(); _typeFinder = ObjectContainer.Resolve <ITypeFinder>(); InitializationPerdictor(); }
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)); } }
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(); }
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); }
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); } }
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); } }
protected BasePredictor(LotteryInfoDto lotteryInfo, AlgorithmType algorithmType) { _LotteryInfo = lotteryInfo; AlgorithmType = algorithmType; }
public StochasticPredictor(LotteryInfoDto lotteryInfo, AlgorithmType algorithmType) : base(lotteryInfo, algorithmType) { }
public override PredictedResult JudgePredictDataResult(LotteryInfoDto lotteryInfo, PredictDataDto startPeriodData, NormConfigDto userNormConfig) { throw new System.NotImplementedException(); }
public abstract PredictedResult JudgePredictDataResult(LotteryInfoDto lotteryInfo, PredictDataDto startPeriodData, NormConfigDto userNormConfig);
private void InitLotteryInfo() { _lotteryInfo = _lotteryQueryService.GetLotteryInfoById(_lotterySession.SystemTypeId); }
private IEnumerable <PredictDataDto> PredictNormData(LotteryInfoDto lotteryInfo, NormConfigDto userNorm, int predictPeroid, bool isSwitchFormula = false) { return(_lotteryPredictDataService.PredictNormData(lotteryInfo.Id, userNorm, predictPeroid, lotteryInfo.LotteryCode, isSwitchFormula)); }
public DiscreteMarkovPredictor(LotteryInfoDto lotteryInfo, AlgorithmType algorithmType) : base(lotteryInfo, algorithmType) { }
public MockPredictor(LotteryInfoDto lotteryInfo, AlgorithmType algorithmType) : base(lotteryInfo, algorithmType) { }
public TemperatureMarkovPredictor(LotteryInfoDto lotteryInfo, AlgorithmType algorithmType) : base(lotteryInfo, algorithmType) { }