(C++ Beginner) Help with simple blackjack program
2 freelancers are bidding on average $155 for this job
Alternatively you could move the card to the players hand, then when you initialize a new deck just create 52 new cards in a fresh deck. It is not necessary to write using Player:: If you want to access private members then maybe you should reconsider why you made them private in the first place.
Home Questions Tags Users Unanswered. Juanshito 29 1 3. There are no King cards? Lot of code but here are some comments. IMHO Use scoped enum for the card suit, as it is now you use char so any char can be accidentally assigned. Deck Use a smart pointer instead of a raw pointer to the cards, that you do not have to worry about memory leaks. If the dealer's total is higher, the player's.
If the player's total is higher, her bankroll increases. If the totals are equal, the bankroll is unchanged; this is called a "push". The only case where the hands are equal that is not a push is when the player and dealer are each dealt.
Note that this is a very simplified form of the game: You will provide one or more implementations of four separate abstractions for this project: All files referenced in this specification. You may copy them to your private directory space, but may not modify them in any way. For this project, the penalty for code that does.
You are to put your implementation of this ADT in a file named "[url removed, login to view]". You must use exactly this. Your third task is to implement three different blackjack players. The interface for a Player is:. The first derived class is the Simple player, who plays a simplified version of basic strategy for blackjack. The simple player always places the minimum allowable wager, and decides to hit or stand based on the. The first set of rules apply if the player has a "hard count" i.
The second set of rules applies if the player has a "soft count" i. The second derived class is the Counting player. This player counts cards in addition to playing the basic. The intuition behind card counting is that when the deck has more face cards worth 10 each.
The converse is also true. The Counting player keeps a running "count" of the cards he's seen from the deck. Each time he sees. When he sees that the deck is shuffled ,. The final derived class you are to implement is the Competitor.
The Competitor can play any strategy. The quality of the Competitor's play will not count toward. All three of these Players must be implemented in a file named "[url removed, login to view]". You must also declare a static global instance of each of the three Players you implement in your. Finally, you should implement the following "access" functions that return pointers to. Finally, you are to implement a driver program that can be used to simulate this version of blackjack. You are to put your implementation of this driver program in a file named "[url removed, login to view]".
The first argument is an integer denoting the player's starting bankroll. The second argument is the. The final argument is one of the three strings. The driver first shuffles the deck. To shuffle the deck, you choose seven cuts between 13 and We have supplied a header, rand.
Then, while the player's bankroll is greater than or equal to minimum bet of 5 and there are hands left. Note that, since we. For example, a wager. In this case, announce the. Draw cards until the player. The dealer must hit until reaching seventeen or. No other system header files may be included, and you may not make any call to any function in any. You may assume that functions are called consistent with their advertised.
For this project, you are required to write, describe, and submit individual, focused test cases for your. For example, if you identify three behaviors in Deck, and two in the Counting player, there would be. Test cases for this project are considered "acceptance tests". Your tests for your deck ADT each of. Your tests for your player ADT each of which includes at. We do not compare the output. Instead, we look at the return value of.
However, you may find it helpful to. Here is an example of code that tests a hypothetical "integer add" function declared in addInts. You will be evaluated based on.
If your test case misidentifies a correct library. So, for example, writing a test case that returns. This project has several components: To build the program,. Programs that do not compile properly will be severely penalized in this project, so be sure to check. We have supplied one simple set of output produced by a correct deck, hand, simple player, and driver.
It is called sample. To test your entire project, type the following into the Linux terminal once your. To do this, you simply list all the filenames you are going to submit.
In addition to the usual prohibition against sharing any code as described in the syllabus you may not. All must be entirely your own work. Hello -- I am the ideal candidate for this project. I have extensive experience in writing poker analysis software, as well as analysis of other games. I have a large amount of free time over the next two days and can More. Need about 8 hours to complete this project.
Ready to start right away. The email address is already associated with a Freelancer account. Enter your password below to link accounts: I forgot my password. Blackjack Simplified Blackjack, also sometimes called 21, is a relatively simple game played with a standard deck of 52 playing cards. The player starts with a bankroll, and the game progresses in rounds called hands.
It can be any amount between some minimum allowable wager and the player's total bankroll, inclusive. If the total includes an ace counted as 11, the total is called "soft", otherwise it is called "hard". The player's goal is to build a hand that totals as close to 21 as possible without going over. If the total is over 21, this is called a "bust", and a player who busts loses the hand without forcing the dealer to play.
As long as the player believes another card will help, the player "hits" by asking the dealer for another card. This process ends either when the player decides to "stand" ask for no more cards or the player busts. Note that a player can stand with two cards; one need not hit at all in a hand.
If the player is dealt an ace plus any ten or face card, the player's hand is called a "natural 21", and the player's wager is paid off with 3 to 2 odds, without examining the dealer's cards. In other words, if the player had wagered 10, the player would win 15 if dealt a natural The dealer must hit until he either reaches a total greater than or equal to 17 hard or soft , or busts. If the dealer busts, the player wins.
If the player's total is higher, her bankroll increases by the amount of her wager. The only case where the hands are equal that is not a push is when the player and dealer are each dealt natural 21s.