Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project Problem #1: 50 points Using MATLAB, build a program that allows the user to play a game of blackjack against the computer Your program

image text in transcribed
image text in transcribed
Project Problem #1: 50 points Using MATLAB, build a program that allows the user to play a game of blackjack against the computer Your program should have the following constraints/requirements -A freshly shuffled deck should be used at the start of each hand -Each card should be drawn from the top of the deck. The player should be able to see the second card dealt to the dealer (computer), but not the first There must be clear instructions asking the user what he would like to do next The user's hand must be displayed to them showing both the current value and the card types they have. Three examples below. Current Hand: (52Qj Score 17) Dealer: L 5 Current Hand: IA A K] Score (12] D Current Hand: [ 10 5 K) Score-|25)-....-_ *BUST" Dealer: L If you are unfamiliar with Blackjack, the rules are as follows Every card has a value of 1-11. The cords 2-20 hove their face value. Jacks, Queens, and Kings all have a value of 10. The Ace con either act as o 1 or an 11, whichever is most beneficial to the player/dealer. At the start of a hand the player and dealer are both dealt twe cards. The object of the gome is to have a collection of cords with a volue greater thon that of the dealer, but not preoter than 22 fter the hand is dealt, the player has the opcion to Hit' or Stay. Selecting Hit should add another card to their hand and resolve the score, making sure to account for any oddities from Aces If they choose Stay they no longer receive cords and the dealer is given the option. The player is allowed to ir any number of times in order to approoch 21 as close es possible if at ony time the ployer's hand exceeds 21, they Bust' on their hand and immediotely lose. If the dealer does this and the player has not, the player outomatically wins Upon choosing to 3tay, the dealer con add to the cards in his hond. Troditionally, the dealer will always choose to HIt' his total is 16 or below. He will choose to Stay'hereoches ot least 17. (Optional oddition: the dealer w also hit on a soft 17, which is o 17 thot has an Ace acting as an 11. For instance (A, 67- 17. The deaier would hit here as there is no risk of busting,J How you approach this program is entirely up to you. However, the use of functions will likely prove useful for determining the cards associated with values 1-52 in the shuffled deck and calculating the current hand value

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago