Ejemplo n.º 1
0
        public BetsProvider(InfoCollection information, Dictionary <InfoProviderType, InfoProviderBase> allInformationProviders, AIRandomControl aiRandomControl)
            : base(information, InfoProviderType.Bets, allInformationProviders, aiRandomControl)
        {
            providedInfoTypes = new List <InfoPiece>()
            {
                new InfoPiece(InfoType.BP_BetsToCall_Byte, 5),
                new InfoPiece(InfoType.BP_LastRoundBetsToCall_Byte, 0),
                new InfoPiece(InfoType.BP_MinimumPlayAmount_Decimal, 0),
                new InfoPiece(InfoType.BP_PlayerHandStartingStackAmount_Decimal, 0),
                new InfoPiece(InfoType.BP_PlayerLastAction_Short, (byte)Definitions.PokerAction.CatastrophicError),
                new InfoPiece(InfoType.BP_PlayerMoneyInPot_Decimal, 0),
                new InfoPiece(InfoType.BP_TotalNumCalls_Byte, 5),
                new InfoPiece(InfoType.BP_TotalNumRaises_Byte, 5),
                new InfoPiece(InfoType.BP_TotalPotAmount_Decimal, 1),
                new InfoPiece(InfoType.BP_CalledLastRound_Bool, 0),
                new InfoPiece(InfoType.BP_RaisedLastRound_Bool, 0),
                new InfoPiece(InfoType.BP_PlayerBetAmountCurrentRound_Decimal, 0),
                new InfoPiece(InfoType.BP_ImmediatePotOdds_Double, 0),
                new InfoPiece(InfoType.BP_TotalNumChecks_Byte, 0),
                new InfoPiece(InfoType.BP_CurrentCallAmountLarger4BB, 1),
                new InfoPiece(InfoType.BP_LastAdditionalRaiseAmount, 0),
                new InfoPiece(InfoType.BP_ScaledCallAmount_Double, 1)
            };

            AddProviderInformationTypes();
        }
Ejemplo n.º 2
0
        public GameProvider(InfoCollection information, Dictionary <InfoProviderType, InfoProviderBase> allInformationProviders, AIRandomControl aiRandomControl)
            : base(information, InfoProviderType.Game, allInformationProviders, aiRandomControl)
        {
            requiredInfoTypes = new List <InfoType>()
            {
            };
            providedInfoTypes = new List <InfoPiece> {
                new InfoPiece(InfoType.GP_NumTableSeats_Byte, 10),
                new InfoPiece(InfoType.GP_NumPlayersDealtIn_Byte, 10),
                new InfoPiece(InfoType.GP_NumActivePlayers_Byte, 10),
                new InfoPiece(InfoType.GP_NumUnactedPlayers_Byte, 0),
                new InfoPiece(InfoType.GP_GameStage_Byte, 0),
                new InfoPiece(InfoType.GP_DealerDistance_Byte, 1)
            };

            AddProviderInformationTypes();
        }
Ejemplo n.º 3
0
        public CardsProvider(InfoCollection information, Dictionary <InfoProviderType, InfoProviderBase> allInformationProviders, AIRandomControl aiRandomControl)
            : base(information, InfoProviderType.Cards, allInformationProviders, aiRandomControl)
        {
            requiredInfoTypes = new List <InfoType>()
            {
            };
            providedInfoTypes = new List <InfoPiece> {
                new InfoPiece(InfoType.CP_AOnBoard_Bool, 1),
                new InfoPiece(InfoType.CP_KOnBoard_Bool, 1),
                new InfoPiece(InfoType.CP_FlushPossible_Bool, 1),
                new InfoPiece(InfoType.CP_StraightPossible_Bool, 1),
                new InfoPiece(InfoType.CP_AKQToBoardRatio_Real, 1),
                new InfoPiece(InfoType.CP_TableStraightDraw_Bool, 1),
                new InfoPiece(InfoType.CP_TableFlushDraw_Bool, 1),

                new InfoPiece(InfoType.CP_HoleCardsAAPair_Bool, 0),
                new InfoPiece(InfoType.CP_HoleCardsKKPair_Bool, 0),
                new InfoPiece(InfoType.CP_HoleCardsOtherHighPair_Bool, 0),
                new InfoPiece(InfoType.CP_HoleCardsOtherLowPair_Bool, 0),
                new InfoPiece(InfoType.CP_HoleCardsOtherPair_Bool, 0),
                new InfoPiece(InfoType.CP_HoleCardsAK_Bool, 0),
                new InfoPiece(InfoType.CP_HoleCardsTroubleHand_Bool, 0),
                new InfoPiece(InfoType.CP_HoleCardsMidConnector_Bool, 0),
                new InfoPiece(InfoType.CP_HoleCardsLowConnector_Bool, 0),
                new InfoPiece(InfoType.CP_HoleCardsSuited_Bool, 0),
                new InfoPiece(InfoType.CP_HoleCardsFlushDraw_Bool, 0),
                new InfoPiece(InfoType.CP_HoleCardsStraightDraw_Bool, 0),
                new InfoPiece(InfoType.CP_HoleCardsOuterStraightDrawWithHC_Bool, 0),
                new InfoPiece(InfoType.CP_HoleCardsInnerStraightDrawWithHC_Bool, 0),
                new InfoPiece(InfoType.CP_HoleCards3KindOrBetterMadeWithHC_Bool, 0),
                new InfoPiece(InfoType.CP_HoleCardsTopOrTwoPair_Bool, 0),
                new InfoPiece(InfoType.CP_HoleCardsAOrKInHand_Bool, 0),
                new InfoPiece(InfoType.CP_HoleCardsMatchedPlayability, 0),
            };

            AddProviderInformationTypes();

            LoadCardUsage("Marc");
            LoadCardUsage("Ailwyn");
            LoadCardUsage("SimpleV7");
            LoadCardUsage("CheatV1");
        }
        public ImpliedOddsProvider(InfoCollection information, Dictionary <InfoProviderType, InfoProviderBase> allInformationProviders, AIRandomControl aiRandomControl)
            : base(information, InfoProviderType.ImpliedOdds, allInformationProviders, aiRandomControl)
        {
            //requiredInfoProviders = new List<InfoProviderType>() {InfoProviderType.PlayerActionPrediction};
            providedInfoTypes = new List <InfoPiece>()
            {
                new InfoPiece(InfoType.IO_ImpliedPotOdds_Double, 0),
            };

            /*
             * requiredInfoTypes = new List<InfoType>() { InfoType.BP_MinimumCallAmount_Decimal,          //Provided
             *                                          InfoType.BP_TotalPotAmount_Decimal,             //Provided
             *                                          InfoType.GP_GameStage_Byte,
             *                                          InfoType.PAP_FoldToBotCall_Prob,
             *                                          InfoType.BP_PlayerBetAmountCurrentRound_Decimal,
             *                                          InfoType.BP_ImmediatePotOdds_Double,
             *                                          InfoType.GP_NumUnactedPlayers_Byte,
             *                                          };
             */
            AddProviderInformationTypes();
        }
Ejemplo n.º 5
0
        public InfoProviderBase(InfoCollection information, InfoProviderType providerType, Dictionary <InfoProviderType, InfoProviderBase> allInformationProviders, AIRandomControl aiRandomControl)
        {
            //this.disableTrueRandomness = disableTrueRandomness;
            this.aiRandomControl = aiRandomControl;

            if (allInformationProviders == null)
            {
                this.providerInitialisationSequenceNum = 1;
            }
            else
            {
                this.providerInitialisationSequenceNum = allInformationProviders.Count + 1;
            }

            if (aiRandomControl.InfoProviderRandomPerHandSeedEnabled)
            {
                this.randomGen = new CMWCRandom(aiRandomControl.InfoProviderRandomPerHandSeed);
            }
            else
            {
                this.randomGen = new CMWCRandom(DateTime.Now.Ticks + providerInitialisationSequenceNum);
            }

            this.providerType            = providerType;
            this.allInformationProviders = allInformationProviders;

            if (this.allInformationProviders != null)
            {
                this.allInformationProviders.Add(providerType, this);
            }

            //We need to check that dependant providers have already been added
            //This code is here but it does not seem to be useable
            if (requiredInfoProviders != null)
            {
                int numRequiredProviders = requiredInfoProviders.Count;

                int requiredInfoProvidersPresent = (from
                                                    availableProviders in allInformationProviders.Values
                                                    join requiredProviders in requiredInfoProviders on availableProviders.ProviderType equals requiredProviders
                                                    select availableProviders).Count();

                if (numRequiredProviders != requiredInfoProvidersPresent)
                {
                    throw new Exception("Required information providers for this provider are not yet present.");
                }
            }

            if (information != null)
            {
                this.infoStore = information;
            }
            else if (requiredInfoTypes != null)
            {
                throw new Exception("InfoStore and GlobalRequestedInfo Types must both be provided or neither, not one or the other.");
            }

            //We need to check that the requiredInfoTypes are already in the infoStore
            if (requiredInfoTypes != null && information != null)
            {
                int numRequiredInfoTypes = requiredInfoTypes.Count;

                int requiredInfoTypesPresent = (from
                                                availableInformation in infoStore.GetInformationStore().Keys
                                                join requiredTypes in requiredInfoTypes on availableInformation equals requiredTypes
                                                select infoStore).Count();

                if (numRequiredInfoTypes != requiredInfoTypesPresent)
                {
                    throw new Exception("Required information types for this provider are not yet present in the information store.");
                }
            }
            else if (requiredInfoTypes != null && information == null)
            {
                throw new Exception("If requiredInfoTypes is not null an infoStore MUST be used!");
            }

            //Setup the slow update function delegates
            lock (slowUpdateLocker)
            {
                if (!slowUpdateTaskDelegates.ContainsKey(providerType))
                {
                    slowUpdateTaskDelegates.Add(providerType, ProviderSlowUpdateTask);
                }
            }
        }