protected override void DisplayOdds(Hand playerHand)
        {
            // Display how the hand rates in Holdem
            float handPercentile = ((HoldemHand)playerHand).GetPrelopPercentile();
            HoldemHand.Rating rating = new HoldemHand.ClassificationPreflop(((HoldemHand)playerHand)).GetRating();
            Color rateColor = Color.FromArgb(184, 0, 0); // Red
            if (rating == HoldemHand.Rating.Monster || rating == HoldemHand.Rating.Strong)
            {
                rateColor = Color.FromArgb(0, 184, 48); // Green
            }
            else if (rating == HoldemHand.Rating.Mediocre || rating == HoldemHand.Rating.Weak)
            {
                rateColor = Color.FromArgb(255, 150, 0); // Orange
            }

            Label lblPreflopRate = new Label();
            lblPreflopRate.Font = new Font("Verdana", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            lblPreflopRate.ForeColor = rateColor;
            lblPreflopRate.BackColor = Color.Transparent;
            lblPreflopRate.Height = 16;
            lblPreflopRate.Text = "Top " + Math.Round(handPercentile * 100, 2) + "%";
            lblPreflopRate.Padding = new System.Windows.Forms.Padding(0, 0, 0, 0);

            handControlLayout.Controls.Add(lblPreflopRate);

            base.DisplayOdds(playerHand);
        }
Example #2
0
        void parser_PlayerMuckHandAvailable(string playerName, Hand hand)
        {
            Player p = FindPlayer(playerName);

            if (p != null)
            {
                p.MuckHandAvailable(hand);
            }
        }
Example #3
0
        private Table table; //Reference to the table that owns this display

        #endregion Fields

        #region Constructors

        public TableDisplayWindow(Table table)
        {
            InitializeComponent();
            this.lastPlayerHand = null;
            this.table = table;
            this.oddsCalculator = OddsCalculator.CreateFor(table.Game);
            this.DoubleBuffered = true;
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.Size = LoadWindowSize();
            this.Location = LoadAbsoluteWindowPosition();
        }
Example #4
0
 public abstract List<Statistic> Calculate(Hand hand);
Example #5
0
        /* A mucked hand became available for this player */
        public override void MuckHandAvailable(Hand hand)
        {
            bool duplicate = hand.Equals(MuckedHand);
            base.MuckHandAvailable(hand);

            // Make sure we're not handling a duplicate... the parser might send multiple mucked hands
            if (!duplicate)
            {
                HoldemHand holdemHand = (HoldemHand)hand;

                Trace.WriteLine("Muck hand available called!");

                // Has this player raised preflop with this hand?
                if (raises[HoldemGamePhase.Preflop].WasIncremented)
                {
                    startingHandsWithPreflopRaise.Add(holdemHand);

                    // Has this player pushed all in preflop with this hand?
                    if (pushedAllIn[HoldemGamePhase.Preflop].WasIncremented)
                    {
                        startingHandsWithPreflopAllIn.Add(holdemHand);
                    }
                }

                // Has this player just limped or called a raise with this hand?
                else if (calls[HoldemGamePhase.Preflop].WasIncremented)
                {
                    startingHandsWithPreflopCall.Add(holdemHand);
                }
            }
        }
Example #6
0
 /* To be called at the end of a round */
 public virtual void ClearHandInformation()
 {
     lastPlayerHand = null;
 }
Example #7
0
        protected virtual void UpdateHandTab(Hand playerHand)
        {
            // Update only if the hand is different than the previous one
            if (PlayerHandHasChanged(playerHand))
            {
                // Clear previous stuff
                handControlLayout.Controls.Clear();

                // Display current hand
                CardListPanel playerCardsPanel = new CardListPanel();
                playerCardsPanel.BackColor = Color.Transparent;
                playerCardsPanel.CardSpacing = CARD_SPACING;
                playerCardsPanel.BorderPadding = CARD_BORDER_PADDING;

                playerCardsPanel.CardListToDisplay = playerHand;
                playerCardsPanel.Height = 80;
                handControlLayout.Controls.Add(playerCardsPanel);

                DisplayOdds(playerHand);
            }
        }
Example #8
0
 protected bool PlayerHandHasChanged(Hand playerHand)
 {
     return lastPlayerHand == null || !playerHand.Equals(lastPlayerHand);
 }
Example #9
0
        protected virtual void DisplayOdds(Hand playerHand)
        {
            // Display odds
            List<Statistic> odds = oddsCalculator.Calculate(playerHand);

            StatisticItemListDisplay statisticListDisplay = CreateStatisticItemListDisplay();
            statisticListDisplay.Add(odds);

            handControlLayout.Controls.Add(statisticListDisplay);
        }
Example #10
0
        public void DisplayPlayerMuckedHand(String playerName, Hand hand)
        {
            EntityCardListPanel ehp = new EntityCardListPanel();
            ehp.EntityName = playerName;
            ehp.CardListToDisplay = hand;

            /* We set the initial size of the component to the largest possible, the
             * addPanel method will take care of setting the proper size */
            ehp.Size = entityHandsContainer.Size;

            entityHandsContainer.AddPanel(ehp, MAXIMUM_CARD_LIST_PANEL_HEIGHT);
        }
Example #11
0
        public void DisplayPlayerHand(CardList playerCards)
        {
            // First create the hand
            Hand playerHand = CreateHandFromCardList(playerCards);

            if (playerHand != null){
                UpdateHandTab(playerHand);

                // Save reference to the current hand
                lastPlayerHand = playerHand;
            }
        }
Example #12
0
 /* A mucked hand became available for this player */
 public virtual void MuckHandAvailable(Hand hand)
 {
     MuckedHand = hand;
     HasShowedThisRound = true;
 }
        public override List<Statistic> Calculate(Hand hand)
        {
            HoldemHand holdemHand = (HoldemHand)hand;
            List<Statistic> result = new List<Statistic>();

            // Depending on what hand we have, we generate only odds that are consistent with our hand

            /* Odds are taken from http://www.flopturnriver.com/Common-Flop-Odds.html
             * since they are better statisticians than I am */

            // Unpaired hole cards
            if (!holdemHand.IsPaired())
            {
                result.Add(new Statistic(new StatisticsOddsData("Flop pair to a hole card", 26.939f, PRECISION)));
                result.Add(new Statistic(new StatisticsOddsData("Flop two pair to a hole card", 2.02f, PRECISION)));
                result.Add(new Statistic(new StatisticsOddsData("Flop trips to a hole card", 1.347f, PRECISION)));
                result.Add(new Statistic(new StatisticsOddsData("Flop full house", 0.092f, PRECISION)));
                result.Add(new Statistic(new StatisticsOddsData("Flop quads", 0.01f, PRECISION)));
            }
            else
            {
                // Paired hole cards
                result.Add(new Statistic(new StatisticsOddsData("Flop two pair by pairing the board", 16.163f, PRECISION)));
                result.Add(new Statistic(new StatisticsOddsData("Flop trips for your pair", 10.775f, PRECISION)));
                result.Add(new Statistic(new StatisticsOddsData("Flop full house (set to your pair)", 0.735f, PRECISION)));
                result.Add(new Statistic(new StatisticsOddsData("Flop full house (trips on board)", 0.245f, PRECISION)));
                result.Add(new Statistic(new StatisticsOddsData("Flop quads", 0.245f, PRECISION)));
            }

            // Unsuited
            if (!holdemHand.IsSuited())
            {
                result.Add(new Statistic(new StatisticsOddsData("Flop a four flush", 2.245f, PRECISION)));
            }
            else
            {
                // Suited
                result.Add(new Statistic(new StatisticsOddsData("Flop a flush", 0.842f, PRECISION)));
                result.Add(new Statistic(new StatisticsOddsData("Flop a four flush", 10.449f, PRECISION)));
            }

            // Connectors from 54 to JT
            if (holdemHand.IsConnectorsInRange(
                    new HoldemHand(new Card(CardFace.Five, CardSuit.Clubs), new Card(CardFace.Four, CardSuit.Clubs)),
                    new HoldemHand(new Card(CardFace.Jack, CardSuit.Clubs), new Card(CardFace.Ten, CardSuit.Clubs))))
            {
                result.Add(new Statistic(new StatisticsOddsData("Flop a straight", 1.306f, PRECISION)));
                result.Add(new Statistic(new StatisticsOddsData("Flop an 8 out straight draw", 10.449f, PRECISION)));
            }

            // One gapped connectors from 53 to QT
            if (holdemHand.IsGappedConnectorsInRange(1,
                    new HoldemHand(new Card(CardFace.Five, CardSuit.Clubs), new Card(CardFace.Three, CardSuit.Clubs)),
                    new HoldemHand(new Card(CardFace.Queen, CardSuit.Clubs), new Card(CardFace.Ten, CardSuit.Clubs))))
            {
                result.Add(new Statistic(new StatisticsOddsData("Flop a straight", 0.980f, PRECISION)));
                result.Add(new Statistic(new StatisticsOddsData("Flop an 8 out straight draw", 8.08f, PRECISION)));
            }

            // Two gapped connectors from 52 to KT
            if (holdemHand.IsGappedConnectorsInRange(2,
                    new HoldemHand(new Card(CardFace.Five, CardSuit.Clubs), new Card(CardFace.Two, CardSuit.Clubs)),
                    new HoldemHand(new Card(CardFace.King, CardSuit.Clubs), new Card(CardFace.Ten, CardSuit.Clubs))))
            {
                result.Add(new Statistic(new StatisticsOddsData("Flop a straight", 0.653f, PRECISION)));
                result.Add(new Statistic(new StatisticsOddsData("Flop an 8 out straight draw", 5.224f, PRECISION)));
            }

            // Three gapped connectors from A5 to AT
            if (holdemHand.IsGappedConnectorsInRange(3,
                    new HoldemHand(new Card(CardFace.Ace, CardSuit.Clubs), new Card(CardFace.Five, CardSuit.Clubs)),
                    new HoldemHand(new Card(CardFace.Ace, CardSuit.Clubs), new Card(CardFace.Ten, CardSuit.Clubs))))
            {
                result.Add(new Statistic(new StatisticsOddsData("Flop a straight", 0.327f, PRECISION)));
                result.Add(new Statistic(new StatisticsOddsData("Flop an 8 out straight draw", 2.612f, PRECISION)));
            }

            return result;
        }