Exemple #1
0
        public Table(String handHistoryFilePath, Window window, PokerClient pokerClient, PlayerDatabase playerDatabase)
        {
            this.handHistoryFilePath = handHistoryFilePath;
            this.window = window;
            this.pokerClient = pokerClient;
            this.playerDatabase = playerDatabase;
            this.Game = PokerGame.Unknown;
            this.maxSeatingCapacity = 0; // We don't know yet
            this.TableId = String.Empty; // We don't know yet
            this.GameID = String.Empty; // We don't know yet
            this.currentHeroName = String.Empty;
            this.currentHeroSeat = 0;
            this.gameType = pokerClient.GetPokerGameTypeFromWindowTitle(WindowTitle);
            this.statistics = new TableStatistics(this); // We don't know what specific kind
            this.Hud = new Hud(this);
            this.visualRecognitionManager = null; // Not all tables have a visual recognition manager
            this.displayWindow = PokerMuck.TableDisplayWindow.CreateForTable(this);

            // By default we use the universal parser
            handHistoryParser = new UniversalHHParser(pokerClient, System.IO.Path.GetFileName(handHistoryFilePath));

            // But as soon as we find what kind of game we're using, we're going to update our parser */
            ((UniversalHHParser)handHistoryParser).GameDiscovered += new UniversalHHParser.GameDiscoveredHandler(handHistoryParser_GameDiscovered);

            playerList = new List<Player>(10); //Usually no more than 10 players per table

            // Init hand history monitor
            hhMonitor = new HHMonitor(handHistoryFilePath, this);
            hhMonitor.StartMonitoring();
        }
        /* Retrieves the a list of positions for the hud display, based on the poker client
         * and the number of seats available. It will return an empty set if the user
         * has never expressed his preference on the matter.
         * The positions are stored as follow:
         * x1,y1;x2,y2; ... ;xn,yn
         * Where x1,y1 is the position of Seat #1
         */
        public List<Point> RetrieveHudWindowPositions(String clientName, int maxSeats, PokerGameType gameType)
        {
            List<Point> hudWindowPositions = new List<Point>();

            // Is the configuration here?
            String settingName = GetSettingNameForHudWindowPositions(clientName, maxSeats, gameType);
            if (HasSetting(settingName))
            {
                // Bingo! Retrieve the positions
                String positions = GetStringSetting(settingName);

                // Split it
                String[] positionList = positions.Split(';');

                // Convert the resulting pair of "xn,yn" into points and add them to the list
                foreach (String position in positionList)
                {
                    String[] components = position.Split(',');
                    int x = Int32.Parse(components[0]);
                    int y = Int32.Parse(components[1]);

                    Point p = new Point(x, y);
                    hudWindowPositions.Add(p);
                }
            }
            else
            {
                // Nop, no config available at the moment
            }

            return hudWindowPositions;
        }
Exemple #3
0
        public Table(String handHistoryFilePath, Window window, PokerClient pokerClient, PlayerDatabase playerDatabase)
        {
            this.handHistoryFilePath = handHistoryFilePath;
            this.window             = window;
            this.pokerClient        = pokerClient;
            this.playerDatabase     = playerDatabase;
            this.Game               = PokerGame.Unknown;
            this.maxSeatingCapacity = 0;            // We don't know yet
            this.TableId            = String.Empty; // We don't know yet
            this.GameID             = String.Empty; // We don't know yet
            this.currentHeroName    = String.Empty;
            this.currentHeroSeat    = 0;
            this.gameType           = pokerClient.GetPokerGameTypeFromWindowTitle(WindowTitle);
            this.statistics         = new TableStatistics(this); // We don't know what specific kind
            this.Hud = new Hud(this);
            this.visualRecognitionManager = null;                // Not all tables have a visual recognition manager
            this.displayWindow            = PokerMuck.TableDisplayWindow.CreateForTable(this);

            // By default we use the universal parser
            handHistoryParser = new UniversalHHParser(pokerClient, System.IO.Path.GetFileName(handHistoryFilePath));

            // But as soon as we find what kind of game we're using, we're going to update our parser */
            ((UniversalHHParser)handHistoryParser).GameDiscovered += new UniversalHHParser.GameDiscoveredHandler(handHistoryParser_GameDiscovered);

            playerList = new List <Player>(10); //Usually no more than 10 players per table

            // Init hand history monitor
            hhMonitor = new HHMonitor(handHistoryFilePath, this);
            hhMonitor.StartMonitoring();
        }
Exemple #4
0
        /// <summary>
        /// Genetic Neural Training With Random Positions, Players and Cards
        /// </summary>
        /// <param name="gameType"></param>
        /// <param name="gameCache"></param>
        /// <param name="playerNames"></param>
        /// <param name="startingStack"></param>
        /// <param name="minNumTablePlayers"></param>
        /// <param name="maxHandsToPlay"></param>
        /// <param name="actionPause"></param>
        /// <param name="aiManager"></param>
        /// <param name="geneticPlayerIds"></param>
        /// <param name="nonGeneticPlayerIds"></param>
        /// <param name="numGeneticTablePlayers"></param>
        public GeneticNeuralTrainingPokerGame(PokerGameType gameType, databaseCacheClient gameCache, string[] playerNames, decimal startingStack, byte minNumTablePlayers, int maxHandsToPlay, int actionPause, AIManager aiManager, List <long> geneticPlayerIds, List <long> nonGeneticPlayerIds, byte numGeneticTablePlayers)
            : base(gameType, gameCache, minNumTablePlayers, aiManager, playerNames, startingStack, maxHandsToPlay, actionPause)
        {
            this.geneticPlayerIds       = geneticPlayerIds;
            this.nonGeneticPlayerIds    = nonGeneticPlayerIds;
            this.numGeneticTablePlayers = numGeneticTablePlayers;

            this.autoRemovePlayersWithLargeStackInBB = 200;
        }
Exemple #5
0
        /// <summary>
        /// Genetic Neural Training With Fixed Positions and Fixed Cards
        /// </summary>
        /// <param name="gameType"></param>
        /// <param name="gameCache"></param>
        /// <param name="playerNames"></param>
        /// <param name="startingStack"></param>
        /// <param name="minNumTablePlayers"></param>
        /// <param name="maxHandsToPlay"></param>
        /// <param name="actionPause"></param>
        /// <param name="aiManager"></param>
        /// <param name="positionPlayerIds"></param>
        /// <param name="cardsManager"></param>
        public GeneticNeuralTrainingPokerGame(PokerGameType gameType, databaseCacheClient gameCache, string[] playerNames, decimal startingStack, byte minNumTablePlayers, int maxHandsBeforeTableReset, int maxHandsToPlay, int actionPause, AIManager aiManager, List <long[]> positionPlayerIds, CardsManager cardsManager)
            : base(gameType, gameCache, minNumTablePlayers, aiManager, playerNames, startingStack, maxHandsToPlay, actionPause)
        {
            this.positionPlayerIds = positionPlayerIds;
            this.cardsManager      = cardsManager;

            //Set the correct dealerIndex based on currentHandIndex
            dealerIndex = (byte)(cardsManager.CurrentHandIndex % gameCache.NumSeats);
            this.autoRemovePlayersWithLargeStackInBB = 200;
            this.maxHandsBeforeTableReset            = maxHandsBeforeTableReset;
        }
Exemple #6
0
 public override bool IsPlayerSeatingPositionRelative(PokerGameType gameType)
 {
     if (gameType == PokerGameType.Tournament)
     {
         return(true);
     }
     else if (gameType == PokerGameType.Ring)
     {
         return(false);
     }
     else
     {
         Trace.WriteLine("Asked about player seating position relativity, but game type is unknown, guessing...");
         return(true);
     }
 }
        public void StoreHudWindowPositions(String clientName, List<Point> positions, PokerGameType gameType)
        {
            // Convert the list of positions into a string format
            // x1,y1;x2,y2;...

            StringBuilder result = new StringBuilder();
            foreach (Point p in positions)
            {
                result.Append(String.Format("{0},{1};", p.X, p.Y));
            }

            // Remove last ;
            result.Remove(result.Length - 1, 1);

            String settingName = GetSettingNameForHudWindowPositions(clientName, positions.Count, gameType);
            SetSetting(settingName, result.ToString());
        }
Exemple #8
0
 public BotVsBotPokerGame(PokerGameType gameType, databaseCacheClient clientCache, byte minNumTablePlayers, AIManager aiManager, string[] playerNames, decimal startingStack, int maxHandsToPlay, int actionPause)
     : base(gameType, clientCache, playerNames, startingStack, minNumTablePlayers, maxHandsToPlay, actionPause, aiManager)
 {
     //Nothing special happens here
 }
Exemple #9
0
 public override bool IsPlayerSeatingPositionRelative(PokerGameType gameType)
 {
     return(false);
 }
Exemple #10
0
 /* Certain poker clients display players on screen centered relative to our hero
  * if this is the case, child classes should return true
  * This is needed in order to decide how to store the hud window positions on file */
 public abstract bool IsPlayerSeatingPositionRelative(PokerGameType gameType);
Exemple #11
0
 public override bool IsPlayerSeatingPositionRelative(PokerGameType gameType)
 {
     return false;
 }
 public ManualNeuralTrainingPokerGame(PokerGameType gameType, databaseCacheClient clientCache, byte minNumTablePlayers, string[] playerNames, decimal startingStack, int maxHandsToPlay, int actionPause, List <Control> neuralTrainingOutputFields, List <Control> neuralPlayerActionLog)
     : base(gameType, clientCache, playerNames, startingStack, minNumTablePlayers, maxHandsToPlay, actionPause)
 {
     this.neuralTrainingOutputFields = neuralTrainingOutputFields;
     this.neuralPlayerActionLog      = neuralPlayerActionLog;
 }
Exemple #13
0
 /* Certain poker clients display players on screen centered relative to our hero
  * if this is the case, child classes should return true
  * This is needed in order to decide how to store the hud window positions on file */
 public abstract bool IsPlayerSeatingPositionRelative(PokerGameType gameType);
Exemple #14
0
 public override bool IsPlayerSeatingPositionRelative(PokerGameType gameType)
 {
     if (gameType == PokerGameType.Tournament) return true;
     else if (gameType == PokerGameType.Ring) return false;
     else
     {
         Trace.WriteLine("Asked about player seating position relativity, but game type is unknown, guessing...");
         return true;
     }
 }
Exemple #15
0
        /* Retrieves the a list of positions for the hud display, based on the poker client
         * and the number of seats available. It will return an empty set if the user
         * has never expressed his preference on the matter.
         * The positions are stored as follow:
         * x1,y1;x2,y2; ... ;xn,yn
         * Where x1,y1 is the position of Seat #1
         */
        public List <Point> RetrieveHudWindowPositions(String clientName, int maxSeats, PokerGameType gameType)
        {
            List <Point> hudWindowPositions = new List <Point>();

            // Is the configuration here?
            String settingName = GetSettingNameForHudWindowPositions(clientName, maxSeats, gameType);

            if (HasSetting(settingName))
            {
                // Bingo! Retrieve the positions
                String positions = GetStringSetting(settingName);

                // Split it
                String[] positionList = positions.Split(';');

                // Convert the resulting pair of "xn,yn" into points and add them to the list
                foreach (String position in positionList)
                {
                    String[] components = position.Split(',');
                    int      x          = Int32.Parse(components[0]);
                    int      y          = Int32.Parse(components[1]);

                    Point p = new Point(x, y);
                    hudWindowPositions.Add(p);
                }
            }
            else
            {
                // Nop, no config available at the moment
            }

            return(hudWindowPositions);
        }
 public string ToShortString()
 {
     return(PokerGameType.ToString() + PokerGame);
 }
 public override string ToString()
 {
     return(PokerGameType.ToString() + PokerGame + (IsZoom ? " Speed" : "") + " " + PokerGamePlayer);
 }
Exemple #18
0
        public void StoreHudWindowPositions(String clientName, List <Point> positions, PokerGameType gameType)
        {
            // Convert the list of positions into a string format
            // x1,y1;x2,y2;...

            StringBuilder result = new StringBuilder();

            foreach (Point p in positions)
            {
                result.Append(String.Format("{0},{1};", p.X, p.Y));
            }

            // Remove last ;
            result.Remove(result.Length - 1, 1);

            String settingName = GetSettingNameForHudWindowPositions(clientName, positions.Count, gameType);

            SetSetting(settingName, result.ToString());
        }
Exemple #19
0
        /* Retrieves the name of the setting used to represent the window hud position
         * for a particular client and the max seating capacity.
         * Ex. client = "PokerStars.it" and maxSeats = 9
         * Result => "PokerStars.it_9_players_hud_window_positions" */
        private String GetSettingNameForHudWindowPositions(String clientName, int maxSeats, PokerGameType gameType)
        {
            // Replace spaces with underscores
            String escapedClientName = clientName.Replace(" ", "_");

            // Convert enum to string
            String readableGameType = gameType.ToString("g");

            return String.Format("{0}_{1}_{2}_players_hud_window_positions", escapedClientName, maxSeats, readableGameType);
        }
Exemple #20
0
        /* Retrieves the name of the setting used to represent the window hud position
         * for a particular client and the max seating capacity.
         * Ex. client = "PokerStars.it" and maxSeats = 9
         * Result => "PokerStars.it_9_players_hud_window_positions" */
        private String GetSettingNameForHudWindowPositions(String clientName, int maxSeats, PokerGameType gameType)
        {
            // Replace spaces with underscores
            String escapedClientName = clientName.Replace(" ", "_");

            // Convert enum to string
            String readableGameType = gameType.ToString("g");

            return(String.Format("{0}_{1}_{2}_players_hud_window_positions", escapedClientName, maxSeats, readableGameType));
        }
Exemple #21
0
 public BotVsHumanPokerGame(PokerGameType gameType, databaseCacheClient clientCache, byte minNumTablePlayers, string[] playerNames, decimal startingStack, int maxHandsToPlay, bool useAISetDecisionTime)
     : base(gameType, clientCache, playerNames, startingStack, minNumTablePlayers, maxHandsToPlay, 1500)
 {
     this.useAISetDecisionTime = useAISetDecisionTime;
 }
Exemple #22
0
 public BotVsHumanPokerGame(PokerGameType gameType, databaseCacheClient clientCache, byte minNumTablePlayers, string[] playerNames, decimal startingStack, int maxHandsToPlay, int actionPause, PokerBot.CacheMonitor.CacheMonitor cacheMonitor)
     : base(gameType, clientCache, playerNames, startingStack, minNumTablePlayers, maxHandsToPlay, actionPause)
 {
     this.cacheMonitor = cacheMonitor;
 }