コード例 #1
0
ファイル: HoldemBoard.cs プロジェクト: smtheard/PokerMuck
 public HoldemBoard(Card first, Card second, Card third)
     : base("Board")
 {
     AddCard(first);
     AddCard(second);
     AddCard(third);
 }
コード例 #2
0
ファイル: CardListPanel.cs プロジェクト: smtheard/PokerMuck
 public void AddCardToList(Card c)
 {
     if (cardListToDisplay != null)
     {
         cardListToDisplay.AddCard(c);
         ReloadGraphics();
     }
 }
コード例 #3
0
ファイル: CardPictureBox.cs プロジェクト: smtheard/PokerMuck
        public CardPictureBox(Card card)
        {
            this.card = card;
            this.SizeMode = PictureBoxSizeMode.StretchImage;
            this.ClientSize = GetImageSize();
            this.heightWidthRatio = (float)ClientSize.Height / (float)ClientSize.Width;

            ReloadImage();
        }
コード例 #4
0
        public SelectableCardPictureBox(Card card)
            : base(card)
        {
            highlighted = false;
            this.highlightTransparency = 100;
            this.highlightColor = Color.White;

            this.MouseEnter += new EventHandler(SelectableCardPictureBox_MouseEnter);
            this.MouseLeave += new EventHandler(SelectableCardPictureBox_MouseLeave);
            this.MouseClick += new MouseEventHandler(SelectableCardPictureBox_MouseClick);
        }
コード例 #5
0
        private void btnViewAll_Click(object sender, EventArgs e)
        {
            SingleCardSelectDialog d = new SingleCardSelectDialog();
            d.ShowDialog();

            if (d.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                SelectedCard = Card.CreateFromString(d.SelectedCard);
                DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
        }
コード例 #6
0
ファイル: VisualMatcher.cs プロジェクト: smtheard/PokerMuck
        private void ReplaceTemplateImageWith(Card matchedCard, Bitmap newImage)
        {
            // Find the path of the template associated with the card
            String targetFile = String.Format("{0}{1}", CardMatchesDirectory, matchedCard.ToFilename("bmp"));

            try
            {
                newImage.Save(targetFile, ImageFormat.Bmp);
                Trace.WriteLine("Successfully replaced " + targetFile + " with new image");
            }
            catch (Exception)
            {
                Trace.WriteLine("Warning! Tried to replace " + targetFile + " with a new image but failed because of an exception");
            }
        }
コード例 #7
0
ファイル: CardList.cs プロジェクト: smtheard/PokerMuck
 public void AddCard(Card card)
 {
     cards.Add(card);
 }
コード例 #8
0
ファイル: CardList.cs プロジェクト: smtheard/PokerMuck
        /* @param matching points to a card in the set of identical ones (if any) */
        public bool HaveIdenticalFaces(int numIdenticalFaces, out Card matching)
        {
            matching = null;

            for (int i = 0; i < cards.Count; i++)
            {
                int facesCount = 0;
                for (int j = i + 1; j < cards.Count; j++)
                {
                    if (cards[i].Face == cards[j].Face)
                    {
                        facesCount++;
                    }
                }

                if (facesCount >= numIdenticalFaces - 1)
                {
                    matching = cards[i];
                    return true;
                }
            }

            return false;
        }
コード例 #9
0
ファイル: HoldemHand.cs プロジェクト: smtheard/PokerMuck
        /* Checks that every possible hand is covered in the table */
        public static void TestPercentiles()
        {
            for (CardFace face1 = CardFace.Ace; face1 <= CardFace.King; face1++)
            {
                for (CardSuit suit1 = CardSuit.Clubs; suit1 <= CardSuit.Spades; suit1++)
                {
                    Card c1 = new Card(face1, suit1);

                    for (CardFace face2 = CardFace.Ace; face2 <= CardFace.King; face2++)
                    {
                        for (CardSuit suit2 = CardSuit.Clubs; suit2 <= CardSuit.Spades; suit2++)
                        {
                            Card c2 = new Card(face2, suit2);

                            HoldemHand hand = new HoldemHand(c1, c2);
                            Trace.Assert(HoldemHand.preflopPercentiles.ContainsKey(hand.ToString()), "Percentile not found for: " + hand.ToString());
                        }
                    }
                }
            }
        }
コード例 #10
0
 public void AddPossibleCardMatch(Card card)
 {
     cardListPanel.AddCardToList(card);
 }
コード例 #11
0
ファイル: PokerClient.cs プロジェクト: smtheard/PokerMuck
        /* Given a string representing a card, returns the equivalent card object
           This seems to be a standard format across poker client.
           Cards are represented by two chars, the first indicating the face
         * and the second indicating the suit. Ex. Ks, Ah, etc. */
        public virtual Card GenerateCardFromString(String card)
        {
            // This should never be different than 2
            Trace.Assert(card.Length == 2, "A string representation of a card was found to be of invalid length: " + card.Length + " instead of 2");

            // Uppercase to simplify checks
            String cardValues = card.ToUpper();

            // Extract components
            Char faceComponent = cardValues[0];
            Char suitComponent = cardValues[1];

            CardFace face = Card.CharToCardFace(faceComponent);
            CardSuit suit = Card.CharToCardSuit(suitComponent);

            Card result = new Card(face, suit);
            return result;
        }
コード例 #12
0
ファイル: HoldemBoard.cs プロジェクト: smtheard/PokerMuck
 public HoldemBoard(Card first, Card second, Card third, Card fourth, Card fifth)
     : this(first, second, third, fourth)
 {
     AddCard(fifth);
 }
コード例 #13
0
 void pictureBox_CardSelected(Card c)
 {
     // bubble up
     if (CardSelected != null) CardSelected(c);
 }
コード例 #14
0
ファイル: HoldemHand.cs プロジェクト: smtheard/PokerMuck
            private PairType GetPairType(CardList communityCards, Card matching, Card firstCard, Card secondCard)
            {
                communityCards.Sort(SortUsing.AceHigh);

                // Pocket pair
                if (firstCard.Face == secondCard.Face)
                {
                    if (firstCard.GetFaceValue() >= communityCards.Last.GetFaceValue()) return PairType.Top;
                    else if (firstCard.GetFaceValue() <= communityCards[0].GetFaceValue()) return PairType.Bottom;
                    else return PairType.Middle;
                }
                else
                {
                    // Matched the board
                    if (matching.Face == communityCards.Last.Face) return PairType.Top;
                    else if (matching.Face == communityCards[0].Face) return PairType.Bottom;
                    else return PairType.Middle;
                }
            }
コード例 #15
0
ファイル: HoldemHand.cs プロジェクト: smtheard/PokerMuck
 private KickerType GetKickerTypeFromCard(Card c)
 {
     switch (c.Face)
     {
         case CardFace.Ace:
         case CardFace.King:
         case CardFace.Queen:
         case CardFace.Jack:
             return KickerType.High;
         case CardFace.Ten:
         case CardFace.Nine:
         case CardFace.Eight:
         case CardFace.Seven:
             return KickerType.Middle;
         case CardFace.Six:
         case CardFace.Five:
         case CardFace.Four:
         case CardFace.Three:
         case CardFace.Two:
             return KickerType.Low;
         default:
             return KickerType.Unknown;
     }
 }
コード例 #16
0
 private void cardListPanel_CardSelected(Card c)
 {
     SelectedCard = c;
     DialogResult = System.Windows.Forms.DialogResult.OK;
     this.Close();               
 }
コード例 #17
0
ファイル: CardPictureBox.cs プロジェクト: smtheard/PokerMuck
 public void DisplayCard(Card card)
 {
     this.card = card;
     ReloadImage();
 }
コード例 #18
0
ファイル: HoldemHand.cs プロジェクト: smtheard/PokerMuck
 public HoldemHand(Card first, Card second)
     : base()
 {
     AddCard(first);
     AddCard(second);
 }