Beispiel #1
0
        /// <summary>
        /// Compute the probability of folding for non-user players.
        /// </summary>
        /// <returns>Returns the probability of folding the hand.</returns>
        static private double foldProbability(Player player, int currentBid)
        {
            double probability;

            // Players with at least a pair of cards will rarely fold. Unless scared by the bid.
            if (!player.GetRank().ContainsKey(Rank.HighCard))
            {
                int playerRank = (int)player.GetRank().First().Key + 3;
                probability = (0.1 / playerRank) + (currentBid / player.GetMoney() / 2);
            }
            else
            {
                // Players with 2 or 3 as a first card are most likely to fold.
                // The probability of folding decreases with the amount of cards.
                int highCardValue = (int)player.GetRank()[Rank.HighCard][0].Value + 1;
                probability = Math.Pow(Math.Log(14 - highCardValue, 14), 15 + 10 * player.Aggressiveness);
            }

            return(probability);
        }
Beispiel #2
0
        /// <summary>
        /// Compute the probability of raising for non-user players.
        /// </summary>
        /// <returns>Returns the probability of folding the hand.</returns>
        static private double raiseProbability(Player player, int currentBid)
        {
            double probability;
            double highCardValueCoefficient = (double)player.GetRank().First().Value.Last().Value / 100;
            double playerRankCoefficient    = (double)player.GetRank().First().Key / 20;

            // Players with no rank will rarely raise. Unless they bluff; or count on their high card.
            // The players with higher ranks are more likely to raise. Bluffing included.
            //
            // 10% base probability, 5 % for each rank level, 1% for each highest card value level, +-10% from bluffing.
            // Minimum (2♠) => 15% + 0% + 0% - 10% = 5%
            // Maximum (2♠) => 15% + 0% + 0% + 10% = 25%
            // Minimum (7♦ 7♥ 7♣) => 15% + 15% + 5% - 10% = 25%
            // Maximum (7♦ 7♥ 7♣) => 15% + 15% + 5% + 10% = 45%
            // Minimum (10♠ J♠ Q♠ K♠ A♠) => 15% + 40% + 12% - 10% = 57%
            // Maximum (10♠ J♠ Q♠ K♠ A♠) => 15% + 40% + 12% + 10% = 77%

            probability = 0.15 + playerRankCoefficient + highCardValueCoefficient + (0.1 - new Random().NextDouble() * 0.2);

            // If the player already raised, the chances are decimated.
            return(player.DidRaise ? 0.1 * probability : probability);
        }