Пример #1
0
        private int random_bet(Method_Data data)
        {
            double     choice = rand.NextDouble();
            bet_method method_choice;

            if (choice > .9)
            {
                method_choice = extreme_bet;
            }
            else if (choice > .8)
            {
                method_choice = all_in_bet;
            }
            else if (choice > .4)
            {
                method_choice = calculated_bet;
            }
            else if (choice > .3)
            {
                method_choice = tricky_bet;
            }
            else if (choice > .2)
            {
                method_choice = stingy_bet;
            }
            else
            {
                method_choice = reckless_bet;
            }

            return(method_choice(data));
        }
Пример #2
0
        private int all_in_bet(Method_Data data)
        {
            double amount = (double)calculated_bet(data);

            if (amount > .7 * data.available_funds)
            {
                return(data.available_funds);
            }

            return((int)amount);
        }
Пример #3
0
        private int reckless_bet(Method_Data data)
        {
            data.first_turn = false;

            double amount = (double)calculated_bet(data);

            if (amount < .4 * data.total_money)
            {
                amount *= 1.29;
            }

            return((int)amount);
        }
Пример #4
0
        private int extreme_bet(Method_Data data)
        {
            double amount = (double)calculated_bet(data);

            if (data.hand_value < Hand_Values.ONE_PAIR &&
                data.bet > .1 * data.available_funds)
            {
                return(0);
            }
            else if (amount > .7 * data.available_funds)
            {
                return(data.available_funds);
            }
            else
            {
                return((int)amount);
            }
        }
Пример #5
0
        private void set_call_threshholds(ref Method_Data data, int n_folds, Card_Value high_card_value)
        {
            int         bet        = data.bet;
            Hand_Values hand_value = data.hand_value;

            if (bet == 0)
            {
                data.CALL_THRESHHOLD_MIN = Money.DEFAULT_ANTE - 4;
                data.CALL_THRESHHOLD_MAX = Money.DEFAULT_ANTE + 4;
            }
            else if (wealth_type == Wealth_Types.ALRIGHT)
            {
                data.CALL_THRESHHOLD_MIN = (double)bet * .85;
                data.CALL_THRESHHOLD_MAX = (double)bet * 1.15;
            }
            else if (wealth_type == Wealth_Types.WELL_OFF)
            {
                data.CALL_THRESHHOLD_MIN = (double)bet * .82;
                data.CALL_THRESHHOLD_MAX = (double)bet * 1.18;
            }
            else if (wealth_type == Wealth_Types.RICH)
            {
                data.CALL_THRESHHOLD_MIN = (double)bet * .73;
                data.CALL_THRESHHOLD_MAX = (double)bet * 1.27;
            }
            else
            {
                data.CALL_THRESHHOLD_MIN = (double)bet * .9;
                data.CALL_THRESHHOLD_MAX = (double)bet * 1.1;
            }

            // determines when the AI are going to call a player on bullcrap bluffs
            if (n_folds > 6 - (int)perception_type)
            {
                if (hand_value > Hand_Values.HIGH_CARD)
                {
                    data.CALL_THRESHHOLD_MIN = (double)5;
                }
                else if (high_card_value > Card_Value.JACK)
                {
                    data.CALL_THRESHHOLD_MIN = (double)25;
                }
            }
        }
Пример #6
0
        private int stingy_bet(Method_Data data)
        {
            int       amount  = calculated_bet(data);
            const int BET_CAP = 40;

            if (amount > BET_CAP)
            {
                if (amount >= data.CALL_THRESHHOLD_MIN &&
                    amount <= data.CALL_THRESHHOLD_MAX)
                {
                    amount = data.bet;
                }
                else if (amount > BET_CAP)
                {
                    amount = BET_CAP;
                }
            }

            return(amount);
        }
Пример #7
0
        private void set_call_threshholds(ref Method_Data data, int n_folds, Card_Value high_card_value)
        {
            int bet = data.bet;
             Hand_Values hand_value = data.hand_value;

             if (bet == 0)
             {
            data.CALL_THRESHHOLD_MIN = Money.DEFAULT_ANTE - 4;
            data.CALL_THRESHHOLD_MAX = Money.DEFAULT_ANTE + 4;
             }
             else if (wealth_type == Wealth_Types.ALRIGHT)
             {
            data.CALL_THRESHHOLD_MIN = (double)bet * .85;
            data.CALL_THRESHHOLD_MAX = (double)bet * 1.15;
             }
             else if (wealth_type == Wealth_Types.WELL_OFF)
             {
            data.CALL_THRESHHOLD_MIN = (double)bet * .82;
            data.CALL_THRESHHOLD_MAX = (double)bet * 1.18;
             }
             else if (wealth_type == Wealth_Types.RICH)
             {
            data.CALL_THRESHHOLD_MIN = (double)bet * .73;
            data.CALL_THRESHHOLD_MAX = (double)bet * 1.27;
             }
             else
             {
            data.CALL_THRESHHOLD_MIN = (double)bet * .9;
            data.CALL_THRESHHOLD_MAX = (double)bet * 1.1;
             }

             // determines when the AI are going to call a player on bullcrap bluffs
             if (n_folds > 6 - (int)perception_type)
             {
            if (hand_value > Hand_Values.HIGH_CARD)
            {
               data.CALL_THRESHHOLD_MIN = (double)5;
            }
            else if (high_card_value > Card_Value.JACK)
            {
               data.CALL_THRESHHOLD_MIN = (double)25;
            }
             }
        }
Пример #8
0
        private int reckless_bet(Method_Data data)
        {
            data.first_turn = false;

             double amount = (double)calculated_bet(data);

             if (amount < .4 * data.total_money)
             {
            amount *= 1.29;
             }

             return (int)amount;
        }
Пример #9
0
        private int random_bet(Method_Data data)
        {
            double choice = rand.NextDouble();
             bet_method method_choice;

             if (choice > .9)
             {
            method_choice = extreme_bet;
             }
             else if (choice > .8)
             {
            method_choice = all_in_bet;
             }
             else if (choice > .4)
             {
            method_choice = calculated_bet;
             }
             else if (choice > .3)
             {
            method_choice = tricky_bet;
             }
             else if (choice > .2)
             {
            method_choice = stingy_bet;
             }
             else
             {
            method_choice = reckless_bet;
             }

             return method_choice(data);
        }
Пример #10
0
        private int extreme_bet(Method_Data data)
        {
            double amount = (double)calculated_bet(data);

             if (data.hand_value < Hand_Values.ONE_PAIR
            && data.bet > .1 * data.available_funds)
             {
            return 0;
             }
             else if (amount > .7 * data.available_funds)
             {
            return data.available_funds;
             }
             else
             {
            return (int)amount;
             }
        }
Пример #11
0
        private int calculated_bet(Method_Data data)
        {
            // convert data items to normal item
             bool bluff = data.bluff;
             bool first_turn = data.first_turn;
             bool is_call = data.is_call;
             int bet = data.bet;
             int total_money = data.total_money;
             int available_funds = data.available_funds;
             int personal_investment = data.personal_investment;
             double CALL_THRESHHOLD_MIN = data.CALL_THRESHHOLD_MIN;
             double CALL_THRESHHOLD_MAX = data.CALL_THRESHHOLD_MAX;
             Hand_Values hand_value = data.hand_value;

             double amount; // return value in double form
             double investment = (double)personal_investment / total_money * 8; // 0 to 1
             double potential_loss = (double)bet / total_money * 4; // 0 to 1

             if (potential_loss == 0)
             {
            potential_loss = (double)personal_investment / total_money * 4;
             }

             // calculate wealth_factor
             double money_tier = 0;
             if (wealth_type == Wealth_Types.POOR)
             {
            money_tier = (int)Wealth_Values.POOR;
            money_tier *= 1.6;
             }
             else if (wealth_type == Wealth_Types.ALRIGHT)
             {
            money_tier = (int)Wealth_Values.ALRIGHT;
            money_tier /= 5;
             }
             else if (wealth_type == Wealth_Types.WELL_OFF)
             {
            money_tier = (int)Wealth_Values.WELL_OFF;
            money_tier /= 15;
             }
             else if (wealth_type == Wealth_Types.RICH)
             {
            money_tier = (int)Wealth_Values.RICH;
            money_tier /= 50;
             }

             int capper = 1;
             int bet_temp = bet;
             while (bet_temp > 0)
             {
            bet_temp /= 10;
            ++capper;
             }
             capper *= 3;

             double wealth_factor = 1.8 / (((int)wealth_type + 5) / (double)2 / ((int)wealth_type + 1));

             //double max_amount = potential_loss * chances * money_tier * investment * wealth_factor; // $ willing to bet
             double max_amount = .482 * Math.Sqrt(3 * (double)bet) + (0.0184 * (chances - 0.70) / .35) * money_tier + 5; // ERROR TESTING adjust bit in front of chances once chances gets fixed
             //max_amount /= capper;

             int[] hand_value_factors = { 1, 3, 6, 8, 9, 10, 11, 13, 15, 17, 20, 24, 30 };

             /*
             Console.WriteLine("Stats:");
             Console.WriteLine("\tfirst_turn: {0}", first_turn);
             Console.WriteLine("\tis_call: {0}", is_call);
             Console.WriteLine("\tbet: {0}", bet);
             Console.WriteLine("\ttotal_money: {0}", total_money);
             Console.WriteLine("\tavailable_funds: {0}", available_funds);
             Console.WriteLine("\t\tpotential_loss: {0}", potential_loss);
             Console.WriteLine("\t\tchances: {0}", chances);
             Console.WriteLine("\t\tmoney_tier: {0}", money_tier);
             Console.WriteLine("\t\tinvestment: {0}", investment);
             Console.WriteLine("\t\twealth_factor: {0}", wealth_factor);
             Console.WriteLine();
             Console.WriteLine("max_amount: {0}", max_amount);
             */

             //double max_amount = 1 / potential_loss / 10 * available_funds;
             // anywhere from 1/250 to 1/4

             // max raising of x10
             // max raising first turn of x3

             double adjusted_max = max_amount;

             if (bluff
            && hand_value == Hand_Values.HIGH_CARD)
             {
            adjusted_max *= hand_value_factors[rand.Next((int)Hand_Values.ROYAL_FLUSH - (int)Hand_Values.TWO_PAIR) + (int)Hand_Values.TWO_PAIR] / 3 + 1;
             }
             else
             {
            adjusted_max *= hand_value_factors[(int)hand_value] / 3 + 1;
             }

             // willingness to raise instead of call
             if(adjusted_max > bet
            && adjusted_max >= 1.6 * CALL_THRESHHOLD_MAX)
             {
            CALL_THRESHHOLD_MAX *= 2;
             }

             // Console.WriteLine(adjusted_max);

             if (bet < 0
            || adjusted_max < 0)
             {
            amount = 0;
             }
             else if (is_call)
             {
            if (adjusted_max >= CALL_THRESHHOLD_MIN
               && adjusted_max <= CALL_THRESHHOLD_MAX)
            {
               amount = bet;
            }
            else if (adjusted_max > CALL_THRESHHOLD_MAX)
            {
               amount = adjusted_max;
            }
            else
            {
               amount = 0;
            }
             }
             else
             {
            double random_factor = rand.NextDouble() * rand.NextDouble() * (rand.Next(8) + 1) % 1;
            while (random_factor < .85)
            {
               random_factor *= rand.Next(3) + 2;
               if (random_factor > 1)
               {
                  random_factor = 1;
               }
            }

            double recklessness_factor = ((int)wealth_type + 5) / (double)7;

            // Console.WriteLine("random_factor: {0}\nrecklessness: {1}", random_factor, recklessness_factor);

            amount = adjusted_max * random_factor * recklessness_factor;

            // Console.WriteLine("adjusted amount: {0}", amount);

            double investment_factor = 1;

            if (personal_investment > .9 * total_money)
            {
               investment_factor = 2000;
            }
            else if (personal_investment > .7 * total_money)
            {
               investment_factor = 3.5;
            }
            else if (personal_investment > .6 * total_money)
            {
               investment_factor = 2.5;
            }
            else if (personal_investment > .5 * total_money)
            {
               investment_factor = 2;
            }
            else
            {
               investment_factor = 1.1;
               investment_factor += ((double)personal_investment / total_money);
            }

            // Console.WriteLine("investment_factor: {0}", investment_factor);

            amount *= investment_factor;
             }

             if (amount < bet
            && amount != 0)
             {
            Console.WriteLine("final amount: {0}", amount);
             }

             return (int)amount;
        }
Пример #12
0
        private int all_in_bet(Method_Data data)
        {
            double amount = (double)calculated_bet(data);

             if (amount > .7 * data.available_funds)
             {
            return data.available_funds;
             }

             return (int)amount;
        }
Пример #13
0
        private int calculated_bet(Method_Data data)
        {
            // convert data items to normal item
            bool        bluff               = data.bluff;
            bool        first_turn          = data.first_turn;
            bool        is_call             = data.is_call;
            int         bet                 = data.bet;
            int         total_money         = data.total_money;
            int         available_funds     = data.available_funds;
            int         personal_investment = data.personal_investment;
            double      CALL_THRESHHOLD_MIN = data.CALL_THRESHHOLD_MIN;
            double      CALL_THRESHHOLD_MAX = data.CALL_THRESHHOLD_MAX;
            Hand_Values hand_value          = data.hand_value;

            double amount;                                                         // return value in double form
            double investment     = (double)personal_investment / total_money * 8; // 0 to 1
            double potential_loss = (double)bet / total_money * 4;                 // 0 to 1

            if (potential_loss == 0)
            {
                potential_loss = (double)personal_investment / total_money * 4;
            }

            // calculate wealth_factor
            double money_tier = 0;

            if (wealth_type == Wealth_Types.POOR)
            {
                money_tier  = (int)Wealth_Values.POOR;
                money_tier *= 1.6;
            }
            else if (wealth_type == Wealth_Types.ALRIGHT)
            {
                money_tier  = (int)Wealth_Values.ALRIGHT;
                money_tier /= 5;
            }
            else if (wealth_type == Wealth_Types.WELL_OFF)
            {
                money_tier  = (int)Wealth_Values.WELL_OFF;
                money_tier /= 15;
            }
            else if (wealth_type == Wealth_Types.RICH)
            {
                money_tier  = (int)Wealth_Values.RICH;
                money_tier /= 50;
            }

            int capper   = 1;
            int bet_temp = bet;

            while (bet_temp > 0)
            {
                bet_temp /= 10;
                ++capper;
            }
            capper *= 3;

            double wealth_factor = 1.8 / (((int)wealth_type + 5) / (double)2 / ((int)wealth_type + 1));

            //double max_amount = potential_loss * chances * money_tier * investment * wealth_factor; // $ willing to bet
            double max_amount = .482 * Math.Sqrt(3 * (double)bet) + (0.0184 * (chances - 0.70) / .35) * money_tier + 5; // ERROR TESTING adjust bit in front of chances once chances gets fixed

            //max_amount /= capper;

            int[] hand_value_factors = { 1, 3, 6, 8, 9, 10, 11, 13, 15, 17, 20, 24, 30 };

            /*
             * Console.WriteLine("Stats:");
             * Console.WriteLine("\tfirst_turn: {0}", first_turn);
             * Console.WriteLine("\tis_call: {0}", is_call);
             * Console.WriteLine("\tbet: {0}", bet);
             * Console.WriteLine("\ttotal_money: {0}", total_money);
             * Console.WriteLine("\tavailable_funds: {0}", available_funds);
             * Console.WriteLine("\t\tpotential_loss: {0}", potential_loss);
             * Console.WriteLine("\t\tchances: {0}", chances);
             * Console.WriteLine("\t\tmoney_tier: {0}", money_tier);
             * Console.WriteLine("\t\tinvestment: {0}", investment);
             * Console.WriteLine("\t\twealth_factor: {0}", wealth_factor);
             * Console.WriteLine();
             * Console.WriteLine("max_amount: {0}", max_amount);
             */

            //double max_amount = 1 / potential_loss / 10 * available_funds;
            // anywhere from 1/250 to 1/4

            // max raising of x10
            // max raising first turn of x3

            double adjusted_max = max_amount;

            if (bluff &&
                hand_value == Hand_Values.HIGH_CARD)
            {
                adjusted_max *= hand_value_factors[rand.Next((int)Hand_Values.ROYAL_FLUSH - (int)Hand_Values.TWO_PAIR) + (int)Hand_Values.TWO_PAIR] / 3 + 1;
            }
            else
            {
                adjusted_max *= hand_value_factors[(int)hand_value] / 3 + 1;
            }

            // willingness to raise instead of call
            if (adjusted_max > bet &&
                adjusted_max >= 1.6 * CALL_THRESHHOLD_MAX)
            {
                CALL_THRESHHOLD_MAX *= 2;
            }

            // Console.WriteLine(adjusted_max);

            if (bet < 0 ||
                adjusted_max < 0)
            {
                amount = 0;
            }
            else if (is_call)
            {
                if (adjusted_max >= CALL_THRESHHOLD_MIN &&
                    adjusted_max <= CALL_THRESHHOLD_MAX)
                {
                    amount = bet;
                }
                else if (adjusted_max > CALL_THRESHHOLD_MAX)
                {
                    amount = adjusted_max;
                }
                else
                {
                    amount = 0;
                }
            }
            else
            {
                double random_factor = rand.NextDouble() * rand.NextDouble() * (rand.Next(8) + 1) % 1;
                while (random_factor < .85)
                {
                    random_factor *= rand.Next(3) + 2;
                    if (random_factor > 1)
                    {
                        random_factor = 1;
                    }
                }

                double recklessness_factor = ((int)wealth_type + 5) / (double)7;

                // Console.WriteLine("random_factor: {0}\nrecklessness: {1}", random_factor, recklessness_factor);

                amount = adjusted_max * random_factor * recklessness_factor;

                // Console.WriteLine("adjusted amount: {0}", amount);

                double investment_factor = 1;

                if (personal_investment > .9 * total_money)
                {
                    investment_factor = 2000;
                }
                else if (personal_investment > .7 * total_money)
                {
                    investment_factor = 3.5;
                }
                else if (personal_investment > .6 * total_money)
                {
                    investment_factor = 2.5;
                }
                else if (personal_investment > .5 * total_money)
                {
                    investment_factor = 2;
                }
                else
                {
                    investment_factor  = 1.1;
                    investment_factor += ((double)personal_investment / total_money);
                }

                // Console.WriteLine("investment_factor: {0}", investment_factor);

                amount *= investment_factor;
            }

            if (amount < bet &&
                amount != 0)
            {
                Console.WriteLine("final amount: {0}", amount);
            }

            return((int)amount);
        }
Пример #14
0
 private int tricky_bet(Method_Data data)
 {
     data.bluff = true;
     return(calculated_bet(data));
 }
Пример #15
0
        private int stingy_bet(Method_Data data)
        {
            int amount = calculated_bet(data);
             const int BET_CAP = 40;

             if (amount > BET_CAP)
             {
            if (amount >= data.CALL_THRESHHOLD_MIN
               && amount <= data.CALL_THRESHHOLD_MAX)
            {
               amount = data.bet;
            }
            else if(amount > BET_CAP)
            {
               amount = BET_CAP;
            }
             }

             return amount;
        }
Пример #16
0
        // Methods
        public int calculate_bet(bool bluff, bool first_turn, bool is_call, int n_folds, int bet, int total_money, int available_funds, int personal_investment, Hand_Values hand_value, Card_Value high_card_value)
        {
            // calculate chances based off of checking other players cards/current_bets, and how much they just raised

             // based off of hand value and chances of winning,
             //    bet amount is based off of personality and remaining money
             // every chance level based off hand value is .09

             update_wealth_type(available_funds);
             modify_chances(hand_value, high_card_value);

             // fill out method data to pass around
             Method_Data data = new Method_Data();
             data.bluff = bluff;
             data.first_turn = first_turn;
             data.is_call = is_call;
             data.bet = bet;
             data.total_money = total_money;
             data.available_funds = available_funds;
             data.personal_investment = personal_investment;
             data.hand_value = hand_value;
             set_call_threshholds(ref data, n_folds, high_card_value);

             // pass off to personality determiner
             bet_method method_choice;
             switch (betting_type)
             {
            case (Betting_Types.STINGY):
               method_choice = stingy_bet;
               break;
            case(Betting_Types.RECKLESS):
               method_choice = reckless_bet;
               break;
            case(Betting_Types.CALCULATED):
               method_choice = calculated_bet;
               break;
            case(Betting_Types.ALL_IN):
               method_choice = all_in_bet;
               break;
            case(Betting_Types.EXTREME):
               method_choice = extreme_bet;
               break;
            case(Betting_Types.RANDOM):
               method_choice = random_bet;
               break;
            default:
               // Betting_Types.END chosen
               return 0;
             }

             double raw_amount = (double)method_choice(data);
             int amount = (int)raw_amount;

             // account for terribly inadequate hands returning a negative value
             if (raw_amount <= 0)
             {
            if (first_turn
               && data.bet < 40
               && data.bet < .1 * available_funds)
            {
               return data.bet;
            }
            else
            {
               return 0;
            }
             }

             // adjust for tricking opponents on the first turn
             if (first_turn
            && raw_amount > data.bet){
               if (data.bet == 0)
               {
                  amount = (int)raw_amount;
               }
               else if ( raw_amount > data.bet * (1 + (raw_amount - data.bet)/raw_amount) ){
                  amount = (int)(data.bet * (1 + (raw_amount - data.bet) / raw_amount));
               }
               else
               {
                  amount = (int)raw_amount;
               }

               if (amount < data.bet)
               {
                  amount = data.bet;
               }
            // amount /= 1.34;
             }
             else if (!first_turn
            && hand_value >= Hand_Values.TWO_PAIR)
             {
            amount = (int)(raw_amount * (2 + rand.NextDouble() / 2));//2.16);
             }
             else if (!first_turn)
             {
            amount = (int)(raw_amount * (1 + rand.NextDouble())); // 1.34);
             }

             // round off bet to make it look good if other bets have been rounded off
             if (round_off(bet) == bet)
             {
            int new_amount = round_off(amount);
            if(!(new_amount == 0
               && amount != 0))
            {
               if (new_amount >= data.bet)
               {
                  amount = new_amount;
               }
            }
             }

             return amount;
        }
Пример #17
0
 private int tricky_bet(Method_Data data)
 {
     data.bluff = true;
      return calculated_bet(data);
 }
Пример #18
0
        // Methods
        public int calculate_bet(bool bluff, bool first_turn, bool is_call, int n_folds, int bet, int total_money, int available_funds, int personal_investment, Hand_Values hand_value, Card_Value high_card_value)
        {
            // calculate chances based off of checking other players cards/current_bets, and how much they just raised

            // based off of hand value and chances of winning,
            //    bet amount is based off of personality and remaining money
            // every chance level based off hand value is .09

            update_wealth_type(available_funds);
            modify_chances(hand_value, high_card_value);

            // fill out method data to pass around
            Method_Data data = new Method_Data();

            data.bluff               = bluff;
            data.first_turn          = first_turn;
            data.is_call             = is_call;
            data.bet                 = bet;
            data.total_money         = total_money;
            data.available_funds     = available_funds;
            data.personal_investment = personal_investment;
            data.hand_value          = hand_value;
            set_call_threshholds(ref data, n_folds, high_card_value);

            // pass off to personality determiner
            bet_method method_choice;

            switch (betting_type)
            {
            case (Betting_Types.STINGY):
                method_choice = stingy_bet;
                break;

            case (Betting_Types.RECKLESS):
                method_choice = reckless_bet;
                break;

            case (Betting_Types.CALCULATED):
                method_choice = calculated_bet;
                break;

            case (Betting_Types.ALL_IN):
                method_choice = all_in_bet;
                break;

            case (Betting_Types.EXTREME):
                method_choice = extreme_bet;
                break;

            case (Betting_Types.RANDOM):
                method_choice = random_bet;
                break;

            default:
                // Betting_Types.END chosen
                return(0);
            }

            double raw_amount = (double)method_choice(data);
            int    amount     = (int)raw_amount;

            // account for terribly inadequate hands returning a negative value
            if (raw_amount <= 0)
            {
                if (first_turn &&
                    data.bet < 40 &&
                    data.bet < .1 * available_funds)
                {
                    return(data.bet);
                }
                else
                {
                    return(0);
                }
            }

            // adjust for tricking opponents on the first turn
            if (first_turn &&
                raw_amount > data.bet)
            {
                if (data.bet == 0)
                {
                    amount = (int)raw_amount;
                }
                else if (raw_amount > data.bet * (1 + (raw_amount - data.bet) / raw_amount))
                {
                    amount = (int)(data.bet * (1 + (raw_amount - data.bet) / raw_amount));
                }
                else
                {
                    amount = (int)raw_amount;
                }

                if (amount < data.bet)
                {
                    amount = data.bet;
                }
                // amount /= 1.34;
            }
            else if (!first_turn &&
                     hand_value >= Hand_Values.TWO_PAIR)
            {
                amount = (int)(raw_amount * (2 + rand.NextDouble() / 2));//2.16);
            }
            else if (!first_turn)
            {
                amount = (int)(raw_amount * (1 + rand.NextDouble())); // 1.34);
            }

            // round off bet to make it look good if other bets have been rounded off
            if (round_off(bet) == bet)
            {
                int new_amount = round_off(amount);
                if (!(new_amount == 0 &&
                      amount != 0))
                {
                    if (new_amount >= data.bet)
                    {
                        amount = new_amount;
                    }
                }
            }

            return(amount);
        }