haslin.blogg.se

Blackjack program in c
Blackjack program in c




blackjack program in c

The criterion I've used for doubling down is that this gives a better expected gain (positive or negative) than the other alternatives, taking into account the doubled stake.

blackjack program in c

To be reasonably realistic, I decided to anticipate some further strategy tables I've computed for rounds after the initial deal and to assume that further decisions (to hit or stand) will be made in accordance with these tables. The task asks us to calculate precise probabilities for all possible continuations after the player stands, hits, doubles or splits but this is impossible if the player 'hits' or 'splits' as we don't know what decisions (s)he will make subsequently. I then checked the resulting table against a similar one on an 'active' online gambling site (which I'd better not link to here) and the results agreed to 6 decimal places.

  • What can I expect to win/lose over the year?Īs the dealer plays automatically, the first thing I did was to write a function which calculates the probabilities of the dealer ending up with various scores according to the Rules.
  • What can I expect to be my biggest loss?.
  • What can I expect to be my biggest win?.
  • How many days can I expect to win/lose?.
  • You should now create a function which randomly deals hands.Īssuming I play 50 hands at a visit and visit everyday for a year,Īpplying the strategy defined by the tables you have created, Again by considering all continuations recreate the Soft Totals Table again enhanced with precise probabilities.įinally complete your analysis by considering the case when the player's hand contains a pair.Īgain by considering all continuations recreate the Pair Splitting Table again enhanced with precise probabilities. Gather the results together, set a threshold at which you consider it wise to Double the bet and reconstruct the Hard Totals Table enhanced with precise probabilities.Įnhance your analysis by considering the case when the player's hand contains an Ace.

    blackjack program in c

    The objective of this task is to recreate and explore the following strategy charts for the game of blackjack (which is known by many other names as well).īegin by assuming the player's dealt hand contains no aces and is not a pair.Ĭreate functions which given the players dealt cards and the dealers exposed card returns the number of wins and losses for all possible continuations when the player either sticks or hits. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page. #include Ĭard::Card(int ct, int cn) : cardNum(cn), cardType(ct) Ĭout getHand()->getCards().Blackjack strategy is a draft programming task. Besides, it also has a dealer that takes when his hand is under 17 and stands when it is over. This game features betting, taking a card, standing, and splitting a hand.

    blackjack program in c

    I am relatively new to c++ and OOP, so I am asking for feedback on what could be improved.






    Blackjack program in c