Exemplo n.º 1
0
        private void updateRTBHandsData(clsHandsData inputDataList)
        {
            double rfPercentage          = (double)inputDataList.RoyalFlushCount / clsHandsData.NumberOfHands;
            double sfPercentage          = (double)inputDataList.StraightFlushCount / clsHandsData.NumberOfHands;
            double fourOfKindPercentage  = (double)inputDataList.FourOfAKindCount / clsHandsData.NumberOfHands;
            double fhPercentage          = (double)inputDataList.FullHouseCount / clsHandsData.NumberOfHands;
            double fPercentage           = (double)inputDataList.FlushCount / clsHandsData.NumberOfHands;
            double sPercentage           = (double)inputDataList.StraightCount / clsHandsData.NumberOfHands;
            double threeOfKindPercentage = (double)inputDataList.ThreeOfAKindCount / clsHandsData.NumberOfHands;
            double twoPairPercentage     = (double)inputDataList.TwoPairCount / clsHandsData.NumberOfHands;
            double pairPercentage        = (double)inputDataList.PairCount / clsHandsData.NumberOfHands;
            double hcPercentage          = (double)inputDataList.HighCardCount / clsHandsData.NumberOfHands;



            rtbHandData.Clear();
            rtbHandData.AppendText("Hands Data - Christopher Burch 2017");
            rtbHandData.AppendText("\nTotal number of hands: " + clsHandsData.NumberOfHands);
            rtbHandData.AppendText("\n     Royal Flush Count: " + inputDataList.RoyalFlushCount + " - " + rfPercentage.ToString("P"));
            rtbHandData.AppendText("\n  Straight Flush Count: " + inputDataList.StraightFlushCount + " - " + sfPercentage.ToString("P"));
            rtbHandData.AppendText("\n Four of a Kind Count: " + inputDataList.FourOfAKindCount + " - " + fourOfKindPercentage.ToString("P"));
            rtbHandData.AppendText("\n       Full House Count: " + inputDataList.FullHouseCount + " - " + fhPercentage.ToString("P"));
            rtbHandData.AppendText("\n               Flush Count: " + inputDataList.FlushCount + " - " + fPercentage.ToString("P"));
            rtbHandData.AppendText("\n            Straight Count: " + inputDataList.StraightCount + " - " + sPercentage.ToString("P"));
            rtbHandData.AppendText("\nThree of a Kind Count: " + inputDataList.ThreeOfAKindCount + " - " + threeOfKindPercentage.ToString("P"));
            rtbHandData.AppendText("\n          Two Pair Count: " + inputDataList.TwoPairCount + " - " + twoPairPercentage.ToString("P"));
            rtbHandData.AppendText("\n                  Pair Count: " + inputDataList.PairCount + " - " + pairPercentage.ToString("P"));
            rtbHandData.AppendText("\n        High Card Count: " + inputDataList.HighCardCount + " - " + hcPercentage.ToString("P"));
        }
Exemplo n.º 2
0
        private void btnDealHands_Click(object sender, EventArgs e)
        {
            //deal the hands
            for (int i = 0; i < int.Parse(txtNumberOfHands.Text); i++)
            {
                dealSingleHand();
            }

            //send the datalist
            handsDataCounter = new clsHandsData(handsList);


            //print results of random hands to grid, print data to RichTextBox
            printResultsToDataGridView();
            updateRTBHandsData(handsDataCounter);
        }
Exemplo n.º 3
0
        private void btnCustomHand_Click(object sender, EventArgs e)
        {
            /*
             * //Deal the hand
             * gameDeck.shuffleDeck();     //shuffle the deck
             * board.clearCommunityCards();
             *
             * dealNextHand();
             * dealFlop();
             * dealTurn();
             * dealRiver();
             */
            //Must convert from pip input to numeric form which the HandEvaluator can work with
            string pocketCard1 = txtPC1.Text.ToString();
            string pocketCard2 = txtPC2.Text.ToString();
            string boardCard1  = txtBC1.Text.ToString();
            string boardCard2  = txtBC2.Text.ToString();
            string boardCard3  = txtBC3.Text.ToString();
            string boardCard4  = txtBC4.Text.ToString();
            string boardCard5  = txtBC5.Text.ToString();

            int numPocketCard1 = clsCardDeck.convertPipToNumeric(pocketCard1);
            int numPocketCard2 = clsCardDeck.convertPipToNumeric(pocketCard2);
            int numBoardCard1  = clsCardDeck.convertPipToNumeric(boardCard1);
            int numBoardCard2  = clsCardDeck.convertPipToNumeric(boardCard2);
            int numBoardCard3  = clsCardDeck.convertPipToNumeric(boardCard3);
            int numBoardCard4  = clsCardDeck.convertPipToNumeric(boardCard4);
            int numBoardCard5  = clsCardDeck.convertPipToNumeric(boardCard5);

            //should be converted at this point

            //Now populate the seats and board with those values
            testSeat.Hand.Card1 = numPocketCard1;
            testSeat.Hand.Card2 = numPocketCard2;
            board.FirstCard     = numBoardCard1;
            board.SecondCard    = numBoardCard2;
            board.ThirdCard     = numBoardCard3;
            board.FourthCard    = numBoardCard4;
            board.FifthCard     = numBoardCard5;

            board.setCommunityCardsToFive(); //required since flop, turn, and river increase community cards


            clsEvaluateHand playerHandEvaluator = new clsEvaluateHand(testSeat.Hand, board);
            HandEnum        playerHandValue     = playerHandEvaluator.EvaluateHand();

            handValue = playerHandValue.ToString();

            int numericHandValue = determineNumbericHandValue(handValue);

            //create and add current hand object to the list
            clsHandEvalTest currentHandList = new clsHandEvalTest(pocketCard1, pocketCard2, boardCard1, boardCard2, boardCard3, boardCard4, boardCard5, handValue, numericHandValue);  //create the hand object

            handsList.Add(currentHandList);

            //send the datalist
            handsDataCounter = new clsHandsData(handsList);


            //print results of custom hand to grid
            printResultsToDataGridView();
            updateRTBHandsData(handsDataCounter);
        }