ShoeEV() public method

public ShoeEV ( ) : double
return double
Example #1
0
        static void TestSuper()
        {
            Random random = new NPack.MersenneTwister();

            Rules rules = new Rules {
                Decks = 8, MinBet = 100, MaxBet = 20000, Splits = 3
            };

            int    max_bet       = 5000;
            double pp_multiplier = 4.0;
            double ev_cutoff     = 0.0015;

            SuperOptStrategy b = new SuperOptStrategy(max_bet, ev_cutoff, pp_multiplier);


            //PseudoOptStrategy b = new PseudoOptStrategy();

            Game game = new Game(rules, b, pp_multiplier, random);

            game.PlayerMoney = 0;
            double expected_money = (double)game.PlayerMoney;

            game.Bet = 100;             // 1$


            int lowest = game.PlayerMoney, highest = game.PlayerMoney;
            int runs = 0;

            while (true)
            {
                double total_money = (game.PlayerMoney + pp_multiplier * game.PartyPoints) / 100.0;
                if (runs % 10000 == 0)
                {
                    Console.WriteLine("runs: " + runs + " win: " + (double)game.PlayerMoney / 100.0 + "$" + " pp: " + game.party_points);
                    Console.WriteLine("lowest: " + (double)lowest / 100.0 + "$" + " highest: " + (double)highest / 100.0 + "$");
                    Console.WriteLine("total: " + total_money + "$ | expected: " + expected_money / 100.0 + "$");
                    Console.WriteLine();
                }

                game.StartRound();
                game.DealRound();


                expected_money += b.ShoeEV() * game.Bet;

                if (game.PlayerMoney < lowest)
                {
                    lowest = game.PlayerMoney;
                }
                if (game.PlayerMoney > highest)
                {
                    highest = game.PlayerMoney;
                }

                runs++;
            }
        }
Example #2
0
        static void TestSuper()
        {
            Random random = new NPack.MersenneTwister();

            Rules rules = new Rules { Decks = 8, MinBet = 100, MaxBet = 20000, Splits = 3 };

            int max_bet = 5000;
            double pp_multiplier = 4.0;
            double ev_cutoff = 0.0015;

            SuperOptStrategy b = new SuperOptStrategy(max_bet, ev_cutoff, pp_multiplier);

            //PseudoOptStrategy b = new PseudoOptStrategy();

            Game game = new Game(rules, b, pp_multiplier, random);

            game.PlayerMoney = 0;
            double expected_money = (double)game.PlayerMoney;
            game.Bet = 100; // 1$

            int lowest = game.PlayerMoney, highest = game.PlayerMoney;
            int runs = 0;

            while (true)
            {
                double total_money = (game.PlayerMoney + pp_multiplier * game.PartyPoints) / 100.0;
                if (runs % 10000 == 0)
                {
                    Console.WriteLine("runs: " + runs + " win: " + (double)game.PlayerMoney / 100.0 + "$" + " pp: " + game.party_points);
                    Console.WriteLine("lowest: " + (double)lowest / 100.0 + "$" + " highest: " + (double)highest / 100.0 + "$");
                    Console.WriteLine("total: " + total_money + "$ | expected: " + expected_money / 100.0 + "$");
                    Console.WriteLine();
                }

                game.StartRound();
                game.DealRound();

                expected_money += b.ShoeEV() * game.Bet;

                if (game.PlayerMoney < lowest)
                    lowest = game.PlayerMoney;
                if (game.PlayerMoney > highest)
                    highest = game.PlayerMoney;

                runs++;
            }
        }
Example #3
0
        static void CompareStrategies2()
        {
            Random masterRandom = new NPack.MersenneTwister();


            Rules rules = new Rules {
                Decks = 8, MinBet = 100, MaxBet = 20000, Splits = 3
            };

            int    max_bet       = 5000;
            double pp_multiplier = 4.0;
            double ev_cutoff     = 0.0015;

            SuperOptStrategy b1 = new SuperOptStrategy(max_bet, ev_cutoff, pp_multiplier);
            OptStrategy      b2 = new OptStrategy(max_bet, ev_cutoff, pp_multiplier);
            BasicStrategy    b3 = new BasicStrategy(max_bet, ev_cutoff, pp_multiplier);

            Game game1 = new Game(rules, b1, pp_multiplier, new NPack.MersenneTwister());
            Game game2 = new Game(rules, b2, pp_multiplier, new NPack.MersenneTwister());
            Game game3 = new Game(rules, b3, pp_multiplier, new NPack.MersenneTwister());

            int    runs     = 0;
            double expected = 0;

            while (true)
            {
                if (runs % 10000 == 0)
                {
                    double total1 = TotalMoney(game1);
                    double total2 = TotalMoney(game2);
                    double total3 = TotalMoney(game3);

                    Console.WriteLine();
                    Console.WriteLine("Runs:           {0}", runs);
                    Console.WriteLine("Expected total: $ {0:0.00}", expected);
                    Console.WriteLine("SuperOpt total: $ {1:0.00} ({2:0.00} c/hand)", b1.GetType(), total1, total1 * 100.0 / (double)runs);
                    Console.WriteLine("Opt total:      $ {1:0.00} ({2:0.00} c/hand)", b2.GetType(), total2, total2 * 100.0 / (double)runs);
                    Console.WriteLine("Basic total:    $ {1:0.00} ({2:0.00} c/hand)", b3.GetType(), total3, total3 * 100.0 / (double)runs);

                    TextWriter writer = new StreamWriter("compare.txt", true);

                    writer.WriteLine(string.Format("{0} {1} {2} {3} {4}", runs, expected, total1, total2, total3));

                    writer.Close();
                }

                int seed = masterRandom.Next();

                game1.Random = new NPack.MersenneTwister(seed);
                game2.Random = new NPack.MersenneTwister(seed);
                game3.Random = new NPack.MersenneTwister(seed);

                game1.ResetShoe();
                game2.ResetShoe();
                game3.ResetShoe();

                int remove_count = masterRandom.Next(84);

                game1.RemoveCards(remove_count);
                game2.RemoveCards(remove_count);
                game3.RemoveCards(remove_count);

                expected += b1.ShoeEV() * b1.Bet(game1) / 100.0;

                game1.StartRound();
                game2.StartRound();
                game3.StartRound();

                game1.DealRound();
                game2.DealRound();
                game3.DealRound();

                runs++;
            }
        }
Example #4
0
        static void CompareStrategies2()
        {
            Random masterRandom = new NPack.MersenneTwister();

            Rules rules = new Rules { Decks = 8, MinBet = 100, MaxBet = 20000, Splits = 3 };

            int max_bet = 5000;
            double pp_multiplier = 4.0;
            double ev_cutoff = 0.0015;

            SuperOptStrategy b1 = new SuperOptStrategy(max_bet, ev_cutoff, pp_multiplier);
            OptStrategy b2 = new OptStrategy(max_bet, ev_cutoff, pp_multiplier);
            BasicStrategy b3 = new BasicStrategy(max_bet, ev_cutoff, pp_multiplier);

            Game game1 = new Game(rules, b1, pp_multiplier, new NPack.MersenneTwister());
            Game game2 = new Game(rules, b2, pp_multiplier, new NPack.MersenneTwister());
            Game game3 = new Game(rules, b3, pp_multiplier, new NPack.MersenneTwister());

            int runs = 0;
            double expected = 0;

            while (true)
            {
                if (runs % 10000 == 0)
                {
                    double total1 = TotalMoney(game1);
                    double total2 = TotalMoney(game2);
                    double total3 = TotalMoney(game3);

                    Console.WriteLine();
                    Console.WriteLine("Runs:           {0}", runs);
                    Console.WriteLine("Expected total: $ {0:0.00}", expected);
                    Console.WriteLine("SuperOpt total: $ {1:0.00} ({2:0.00} c/hand)", b1.GetType(), total1, total1 * 100.0 / (double)runs);
                    Console.WriteLine("Opt total:      $ {1:0.00} ({2:0.00} c/hand)", b2.GetType(), total2, total2 * 100.0 / (double)runs);
                    Console.WriteLine("Basic total:    $ {1:0.00} ({2:0.00} c/hand)", b3.GetType(), total3, total3 * 100.0 / (double)runs);

                    TextWriter writer = new StreamWriter("compare.txt", true);

                    writer.WriteLine(string.Format("{0} {1} {2} {3} {4}", runs, expected, total1, total2, total3));

                    writer.Close();
                }

                int seed = masterRandom.Next();

                game1.Random = new NPack.MersenneTwister(seed);
                game2.Random = new NPack.MersenneTwister(seed);
                game3.Random = new NPack.MersenneTwister(seed);

                game1.ResetShoe();
                game2.ResetShoe();
                game3.ResetShoe();

                int remove_count = masterRandom.Next(84);

                game1.RemoveCards(remove_count);
                game2.RemoveCards(remove_count);
                game3.RemoveCards(remove_count);

                expected += b1.ShoeEV() * b1.Bet(game1) / 100.0;

                game1.StartRound();
                game2.StartRound();
                game3.StartRound();

                game1.DealRound();
                game2.DealRound();
                game3.DealRound();

                runs++;
            }
        }