private void SimulateHand(IBlackjack game, int playerDraws)
 {
     for (int draws = 0; draws < playerDraws && !game.HandOver; draws++)
     {
         game.Hit();
     }
     game.Stand();
 }
Exemple #2
0
 public void Play(IBlackjack game)
 {
     if (game.ActiveHand.Value < hitBelow)
     {
         game.Hit();
     }
     else
     {
         game.Stand();
     }
 }
        public double Simulate(IBlackjack game, int playerDraws)
        {
            int wins = 0;

            game.SetState();
            for (int i = 0; i < trials; i++)
            {
                SimulateHand(game, playerDraws);
                game.RestoreState();
            }
            return((double)wins / trials);
        }
Exemple #4
0
        public void Play(IBlackjack game)
        {
            Console.WriteLine(game.ActiveHand);
            Console.WriteLine(game.Dealer);
            Deck deck = game.Deck;

            //Dictionary<int, int> count = ProbabilitiesDraw(deck);
            //foreach (int val in count.Keys)
            //{
            //    Console.Write("(" + val + "," + count[val] + "), ");
            //}
            //Console.WriteLine();
            game.Hit();
        }
        public void Play(IBlackjack game)
        {
            double winZero = Simulate(game, 0);
            double winDraw = 0;

            for (int currentDraw = 1; currentDraw <= maxDraw; currentDraw++)
            {
                winDraw += Simulate(game, currentDraw);
                if (currentDraw == 1 && winDraw > doubleDown)
                {
                    game.DoubleDown();
                    return;
                }
                if (winDraw > winZero)
                {
                    game.Hit();
                    return;
                }
            }
            game.Stand();
        }
Exemple #6
0
 public int GetBet(IBlackjack game)
 {
     return(1);
 }
 public WinningsDisplay(IBlackjack g) => game = g;
Exemple #8
0
 public HomeController(IBlackjack b) => bjGame = b;
 public BlackjackController(IBlackjack b) => bjGame = b;