コード例 #1
0
ファイル: MonteCarloBot.cs プロジェクト: Cannonbait/Blackjack
 private void SimulateHand(IBlackjack game, int playerDraws)
 {
     for (int draws = 0; draws < playerDraws && !game.HandOver; draws++)
     {
         game.Hit();
     }
     game.Stand();
 }
コード例 #2
0
ファイル: SimpleBot.cs プロジェクト: Cannonbait/Blackjack
 public void Play(IBlackjack game)
 {
     if (game.ActiveHand.Value < hitBelow)
     {
         game.Hit();
     }
     else
     {
         game.Stand();
     }
 }
コード例 #3
0
ファイル: MonteCarloBot.cs プロジェクト: Cannonbait/Blackjack
        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);
        }
コード例 #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();
        }
コード例 #5
0
ファイル: MonteCarloBot.cs プロジェクト: Cannonbait/Blackjack
        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();
        }
コード例 #6
0
ファイル: SimpleBot.cs プロジェクト: Cannonbait/Blackjack
 public int GetBet(IBlackjack game)
 {
     return(1);
 }
コード例 #7
0
 public WinningsDisplay(IBlackjack g) => game = g;
コード例 #8
0
 public HomeController(IBlackjack b) => bjGame = b;
コード例 #9
0
 public BlackjackController(IBlackjack b) => bjGame = b;