public PackageTracker(IWebPoster webPoster, IGeocodeDb geocodeDb) { //Todo: This is a bad place to load these: var uspsUserName = WebConfigurationManager.AppSettings["UspsUserName"]; var uspsPassword = WebConfigurationManager.AppSettings["UspsPassword"]; var fedexKey = WebConfigurationManager.AppSettings["FedexKey"]; var fedexPassword = WebConfigurationManager.AppSettings["FedexPassword"]; var fedexAccountNumber = WebConfigurationManager.AppSettings["FedexAccountNumber"]; var fedexMeterNumber = WebConfigurationManager.AppSettings["FedexMeterNumber"]; var coreTrackers = new List <ITracker>(); coreTrackers.Add(new Tracking.Simulation.SimulationTracker()); coreTrackers.Add(new UpsTracker()); coreTrackers.Add(new UspsTracker(new PostUtility(), uspsUserName, uspsPassword, true)); coreTrackers.Add(new FedexTracker(new TrackService(), fedexKey, fedexPassword, fedexAccountNumber, fedexMeterNumber, false)); //coreTrackers.Add(new DhlTracker(new PostUtility(), "", ""); var multiTracker = new MultiTracker(coreTrackers); var cacheTracker = new CacheTracker(multiTracker); var emptyTracker = new EmptyTrackingNumberTracker(cacheTracker); var loggingTracker = new LoggingTracker(emptyTracker); var sanitizerTracker = new TrackingNumberStandardizerTracker(loggingTracker); var geocodingTracker = new GeocodingTracker(sanitizerTracker, geocodeDb); var errorHandlerTracker = new ErrorHandlerTracker(geocodingTracker); _defaultTracker = errorHandlerTracker; }
/// <summary> /// Initialise the AI Manager /// </summary> public AIManagerOld(int providersTimeOutMilliSeconds, int numInstances, bool disableRandomness, bool runInSafeMode) { this.numInstances = numInstances; cacheTracker = new CacheTracker(false); this.providersTimeOutMilliSeconds = providersTimeOutMilliSeconds; //Safe mode increases the amount of error checking on the decision this.runInSafeMode = runInSafeMode; //All instances will use the same required info types #region requiredInfoTypes List <InfoType> requiredInfoTypes = new List <InfoType>() { InfoType.WR_CardsOnlyWinPercentage, InfoType.WR_CardsOnlyWeightedPercentage, InfoType.WR_CardsOnlyOpponentWinPercentage, InfoType.WR_CardsOnlyWeightedOpponentWinPercentage, InfoType.WR_CardsOnlyWinPercentageLastRoundChange, InfoType.WR_CardsOnlyWinRatio, //Player Action Prediction Provider - PAP InfoType.PAP_RaiseToBotCheck_Prob, InfoType.PAP_RaiseToBotCall_Prob, InfoType.PAP_FoldToBotCall_Prob, InfoType.PAP_RaiseToCallAmount_Amount, InfoType.PAP_RaiseToStealSuccess_Prob, InfoType.PAP_RaiseToStealAmount_Amount, //Card Provider InfoType.CP_AOnBoard_Bool, InfoType.CP_KOnBoard_Bool, InfoType.CP_FlushPossible_Bool, InfoType.CP_StraightPossible_Bool, InfoType.CP_AKQToBoardRatio_Real, InfoType.CP_TableFlushDraw_Bool, InfoType.CP_TableStraightDraw_Bool, InfoType.CP_HoleCardsAAPair_Bool, InfoType.CP_HoleCardsKKPair_Bool, InfoType.CP_HoleCardsOtherHighPair_Bool, InfoType.CP_HoleCardsOtherLowPair_Bool, InfoType.CP_HoleCardsTroubleHand_Bool, InfoType.CP_HoleCardsOuterStraightDrawWithHC_Bool, InfoType.CP_HoleCardsInnerStraightDrawWithHC_Bool, InfoType.CP_HoleCards3KindOrBetterMadeWithHC_Bool, InfoType.CP_HoleCardsTopOrTwoPair_Bool, InfoType.CP_HoleCardsAOrKInHand_Bool, InfoType.CP_HoleCardsAK_Bool, InfoType.CP_HoleCardsMidConnector_Bool, InfoType.CP_HoleCardsLowConnector_Bool, InfoType.CP_HoleCardsSuited_Bool, InfoType.CP_HoleCardsFlushDraw_Bool, InfoType.CP_HoleCardsStraightDraw_Bool, //Bets Provider InfoType.BP_TotalPotAmount_Decimal, InfoType.BP_MinimumCallAmount_Decimal, InfoType.BP_BetsToCall_Byte, InfoType.BP_LastRoundBetsToCall_Byte, InfoType.BP_PlayerMoneyInPot_Decimal, InfoType.BP_TotalNumRaises_Byte, InfoType.BP_TotalNumCalls_Byte, InfoType.BP_TotalNumChecks_Byte, InfoType.BP_PlayerHandStartingStackAmount_Decimal, InfoType.BP_PlayerLastAction_Short, InfoType.BP_RaisedLastRound_Bool, InfoType.BP_CalledLastRound_Bool, InfoType.BP_PlayerBetAmountCurrentRound_Decimal, InfoType.BP_ImmediatePotOdds_Double, InfoType.BP_CurrentCallAmountLarger4BB, InfoType.BP_LastAdditionalRaiseAmount, //Game Provider InfoType.GP_NumTableSeats_Byte, InfoType.GP_NumPlayersDealtIn_Byte, InfoType.GP_NumActivePlayers_Byte, InfoType.GP_NumUnactedPlayers_Byte, InfoType.GP_GameStage_Byte, InfoType.GP_DealerDistance_Byte, //ImpliedOdds Provider InfoType.IO_ImpliedPotOdds_Double, //Aggression Provider InfoType.AP_AvgScaledOppRaiseFreq_Double, InfoType.AP_AvgScaledOppCallFreq_Double, InfoType.AP_AvgScaledOppPreFlopPlayFreq_Double }; #endregion //Setup the infostore arrays infoStoreCollection = new InfoCollection[numInstances]; infoProviderCollection = new List <InfoProviderBase> [numInstances]; aiCollection = new List <AIBase> [numInstances]; instanceLocks = new object[numInstances]; for (int i = 0; i < numInstances; i++) { instancesIdle = instancesIdle | (1 << i); } //Setup the instances for (int i = 0; i < numInstances; i++) { infoStoreCollection[i] = new InfoCollection(); infoProviderCollection[i] = new List <InfoProviderBase>(); aiCollection[i] = new List <AIBase>(); instanceLocks[i] = new object(); //Setup the 1st infostore instance (new GameProvider(infoStoreCollection[i], requiredInfoTypes, infoProviderCollection[i], cacheTracker)).StartWorkerThread(); (new WinRatioProvider(infoStoreCollection[i], requiredInfoTypes, infoProviderCollection[i], cacheTracker)).StartWorkerThread(); (new BetsProvider(infoStoreCollection[i], requiredInfoTypes, infoProviderCollection[i], cacheTracker)).StartWorkerThread(); (new CardsProvider(infoStoreCollection[i], requiredInfoTypes, infoProviderCollection[i], cacheTracker)).StartWorkerThread(); (new AggressionProvider(infoStoreCollection[i], requiredInfoTypes, infoProviderCollection[i], cacheTracker)).StartWorkerThread(); (new PlayerActionPredictionProvider(infoStoreCollection[i], requiredInfoTypes, infoProviderCollection[i], cacheTracker, disableRandomness)).StartWorkerThread(); (new ImpliedOddsProvider(infoStoreCollection[i], requiredInfoTypes, infoProviderCollection[i], cacheTracker)).StartWorkerThread(); //Hard lock the infostore collection preventing any further changes. infoStoreCollection[i].HardLockInfoList(); //Setup the AI list aiCollection[i].Add(new SimpleAIV1()); aiCollection[i].Add(new SimpleAIV2()); aiCollection[i].Add(new NeuralAIv1()); aiCollection[i].Add(new SimpleAIV1Adv()); aiCollection[i].Add(new NeuralAIv2()); aiCollection[i].Add(new SimpleAIV4AggTrack(disableRandomness)); aiCollection[i].Add(new NeuralAIv3()); } }